How to increase image size of pandas.DataFrame.plot [duplicate]

Try the figsize parameter 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).

An alternative way is to set desired figsize at the top of the Jupyter Notebook, prior to plotting:

plt.rcParams["figure.figsize"] = (10, 5)

This change will affect all the plots, following this statement.


As per explanation why it doesn’t work for the OP:

plt.figure(figsize=(10,5)) doesn’t work because df.plot() creates its own matplotlib.axes.Axes object, the size of which cannot be changed after the object has been created. For details please see the source code.
Though, one can change default figsize prior to creation, by changing default figsize with plt.rcParams["figure.figsize"] = (width, height)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)