less than 1 minute read

Q:

How can you set parameters such as x- and y-labels? The plot() wrapper for pandas DataFrames does not take those parameters?

A:

The df.plot() function returns a matplotlib.axes.AxesSubplot object. You can set the labels on that object.

>>> ax = df2.plot()
>>> ax.set_xlabel("x label")
>>> ax.set_ylabel("y label")

Via Stack Overflow.

Leave a comment