Snowballion Fisher
Snowballion Fisher

Reputation: 27

Adding X and Y labels to pandas plot

Very new to python, its part of my course but I don't have a great understanding of all the libraries such as pandas, and mattplotlib.

I have code

# plot graph for counts per minute
plt.axes(frameon=0) # reduce chart junk
minute_ct.plot(kind='line', 
   rot=0, title="Summary of packet activity",  figsize=(20,10)).grid(False)
plt.show()

It's currently running off a series not a dataframe so I cant label the columns to get the labels as far as I'm aware, is there a way to label the axes in the plot declaration?

Upvotes: 1

Views: 342

Answers (2)

willcrack
willcrack

Reputation: 1852

Do:

plt.xlabel('x label')
plt.ylabel('y label')

You can find some examples of matplotlib usage here.

Upvotes: 2

heydar dasoomi
heydar dasoomi

Reputation: 557

Use this:

plt.set_xlabel("x label")
plt.set_ylabel("y label")

Upvotes: 0

Related Questions