Simon Righley
Simon Righley

Reputation: 4969

Setting python pandas histogram size

I'm trying to set size of pandas histogram when saving to a file. I go about this like that:

fig = df_analyze.hist();
fig.set_size_inches(16,12)
plt.savefig('hist.png')

But this doesn't work. What is the correct syntax?

Upvotes: 0

Views: 2143

Answers (1)

Simon Righley
Simon Righley

Reputation: 4969

Setting

rcParams['figure.figsize'] = 16, 12

before calling df_analyze.hist() does the job. So, the full solution reads:

rcParams['figure.figsize'] = 16, 12
df_analyze.hist()
plt.savefig('hist.png')

Upvotes: 2

Related Questions