To plot a graph with variables using matplotlib, you first need to import the matplotlib library. Then, you can create a figure and axis object using the plt.subplots() function. Next, you can use the plot() function to plot your variables on the graph. You can customize the graph by adding labels to the x and y axes, setting the title of the graph, and changing the color or style of the plotted lines. Once you have finished customizing your graph, you can display it using the show() function.