31

I am trying to make histograms for a dataframe with pandas 0.11.0 but the figure size is too small. How to change it?

In pandas 0.19.0, hist has the figsize parameter.

cottontail
  • 10,268
  • 18
  • 50
  • 51
AbhiGupta
  • 474
  • 1
  • 6
  • 14
  • 1
    Please see [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) for help on asking a question. – FamousJameous Apr 13 '17 at 22:20

2 Answers2

75

Let's try something like this:

   fig = plt.figure(figsize = (15,20))
   ax = fig.gca()
   df.hist(ax = ax)
Scott Boston
  • 147,308
  • 15
  • 139
  • 187
1

As mentioned in the OP, since pandas 0.15.0, df.hist(figsize=(15, 20)) or df.plot(kind='hist', figsize=(15, 20)) is possible. Another way is to create a subplot and set figure size.

fig, ax = plt.subplots(1, figsize=(15, 20))
df.plot(kind='hist', ax=ax);
cottontail
  • 10,268
  • 18
  • 50
  • 51