df.hist() is not returning plot of desired size

Question:

I am using df.hist() to get plots of all the columns in my DataFrame. The problem is that it is not displaying my plots in desired dimensions

I am using following code:

plt.figure(figsize=(10,12))
df.hist()
plt.show()

it returns me with a grid of histograms but with a very small view along with a text

<Figure size 720×864 with 0 Axes>

On increasing the size, suppose figsize=(20,24), Doubled!

it still returns me with a grid of histograms of the same size, however, the text in output correctly mentions the change,

<Figure size 1440×1728 with 0 Axes>

What is going wrong here? And what is the simplest way to get my grid of histograms displayed in the size I request?

P.S. I checked for other plots for Series and columns and they are working fine by returning me plots of the size I mention in figsize.

The problem is with df.hist()

Thank you

Asked By: letdatado

||

Answers:

You can just pass the size to hist:

ax = df.hist(figsize=(10,12))
plt.show()
Answered By: Quang Hoang