How to plot multiple dataframes to the same plot axes

To plot all columns against the index as line plots.

ax = df1.plot()
df2.plot(ax=ax)

A single pandas.DataFrame.plot (not subplots=True) returns a matplotlib.axes.Axes, which you can then pass to the second dataframe.

To plot specific columns as x and y. Specifying x and y is required for scatter plots (kind='scatter').

ax = df1.plot(x='Lat', y='Lon', figsize=(8, 8))
df2.plot(ax=ax, x='Lat', y='Lon')

Leave a Comment