pandas Plot on an existing matplotlib axis


By default, plot() creates a new figure each time it is called. It is possible to plot on an existing axis by passing the ax parameter.

plt.figure()  # create a new figure
ax = plt.subplot(121)  # create the left-side subplot
df1.plot(ax=ax)  # plot df1 on that subplot
ax = plt.subplot(122)  # create the right-side subplot
df2.plot(ax=ax)  # and plot df2 there  # show the plot