Making a figure longer in Python

Viewed 548

I have a dataframe with one column and 80 rows, and I want to visualize it as a horizontal bar chart. I use pandas plot() function like this:

df.plot(kind='barh')
plt.show()

But, because my dataframe has too many rows, the result is enter image description here

How I can make the figure longer? Becasue I think if the figure becomes longer, all the row information will fit into the vertical axis.

2 Answers

use figsize parameter of plot function

figsize=(length, height)

df.plot(figsize=(20,20), kind='barh')
plt.show()

Give the figure more height:

fig, ax = plt.subplots(figsize=(15,15))
ax.plot(kind='barh')
plt.show()
Related