Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase image size in matplotlib and pandas?

I am trying to increase the size of the image resulting from this function:

plt.figure()); data_ordertotal.plot(); plt.legend(loc='best')

I tried this but the size remains the same

plt.figure(figsize=(40,40)); data_ordertotal.plot(); plt.legend(loc='best')

I am coding using spyder and the output in the console remains always the same size. Any solution? Thanks

like image 656
Blue Moon Avatar asked Jul 24 '15 13:07

Blue Moon


1 Answers

I guess you're using pandas, and you should use:

data_ordertotal.plot(figsize=(40,40))

It doesn't work with plt.figure(figsize=(40,40)) because pandas will create a new figure if you don't pass it an axe object.

It would work with:

fig, ax = plt.subplots(1, 1, figsize=(40,40))
data_ordertotal.plot(ax=ax)

...Assuming you're using pandas, if not you should detail a bit more what is data_ordertotal

HTH

like image 188
jrjc Avatar answered Sep 24 '22 22:09

jrjc