I am using matplotlib.pyplot to plot a histogram and i want to increase the size of the plot. The code to plot is:
plt.hist(x)
plt.xlabel("Months")
plt.ylabel("Donated")
plt.figure(figsize=(6,4))
plt.show()
But plt.figure(..) is not having any affect on the size of the the graph. I am using Spyder IDE.
You want to define your figure space prior to creating the plot information.
plt.figure(figsize=(6,4))
plt.hist(x)
plt.xlabel("Months")
plt.ylabel("Donated")
plt.show()
This will define your figure then plot information in that space, otherwise Matplotlib will use defaults.
Just put it at the top:
plt.figure(figsize=(10,20))
plt.hist(x)
plt.xlabel("Months")
plt.ylabel("Donated")
plt.show()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With