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.
This question is related to
pandas
matplotlib
ipython
jupyter
Try this:
import matplotlib as plt
after importing the file we can use matplotlib library but remember to use it as plt
df.plt(kind='line',figsize=(10,5))
after that the plot will be done and size increased. In figsize the 10 is for breadth and 5 is for height. Also other attributes can be added to the plot too.
Try figsize
param in df.plot(figsize=(width,height))
:
df = pd.DataFrame({"a":[1,2],"b":[1,2]})
df.plot(figsize=(3,3));
df = pd.DataFrame({"a":[1,2],"b":[1,2]})
df.plot(figsize=(5,3));
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
If you want to make a change global to the whole notebook:
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams["figure.figsize"] = [10, 5]
Source: Stackoverflow.com