How to increase image size of pandas.DataFrame.plot in jupyter notebook?

mommomonthewind picture mommomonthewind · Jul 4, 2018 · Viewed 95k times · Source

How can I modify the size of the output image of the function pandas.DataFrame.plot?

I tried:

plt.figure (figsize=(10,5))

and

%matplotlib notebook

but none of them work.

Answer

Sergey Bushmanov picture Sergey Bushmanov · Jul 4, 2018

Try figsize param in df.plot(figsize=(width,height)):

df = pd.DataFrame({"a":[1,2],"b":[1,2]})
df.plot(figsize=(3,3));

enter image description here

df = pd.DataFrame({"a":[1,2],"b":[1,2]})
df.plot(figsize=(5,3));

enter image description here

The size in figsize=(5,3) is given in inches per (width, height)

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.plot.html