artyomboyko
artyomboyko

Reputation: 2861

Pandas plot change y axis

I have DataFrame that looks like this

enter image description here

I want to plot it:

df2[['width', 'height', 'depth']].head(20).plot.bar(figsize=(8, 8), fontsize=16)

enter image description here

Works great, but there I need increase amount of points of Y axis. I want to add numbers like 2400, 1900, etc. How can I do that? Why is there only 6 points on Y axis ?

Upvotes: 1

Views: 5515

Answers (1)

Clock Slave
Clock Slave

Reputation: 7967

Okay so you only need to pass in the yticks argument. yticks is not a direct argument for bar but it passed on to plot.

df2[['width', 'height', 'depth']].head(20).plot.bar(figsize=(8, 8), fontsize=16, yticks = range(0,2600,200))
plt.show()

Result:

enter image description here

You can also use xticks if you want to do the same for the x-axis

Upvotes: 6

Related Questions