ax = df1.plot() ax.set_xlabel("x label") ax.set_ylabel("y label") plt.Show()
Here is what the above code is Doing:
1. We’re creating a figure and an axes using plt.subplots.
2. We’re plotting on that axes (since it’s the most recently created) using plot().
3. We’re adding labels to the x-axis and y-axis.
4. We’re showing the plot.
The plot() method on Series and DataFrame is just a simple wrapper around plt.plt():