I am trying to plot a histogram with a series using numpy array.
n,bins,patch = plt.hist(ser,bins=10, color='green', alpha=0.8, label='Value', edgecolor='orange', linewidth=2)
plt.legend()
plt.ylabel('No of bags', size='x-large')
plt.xlabel('Money in US $', size= 'x-large')
IT is working well but the size is spo small. I tried using olt.hist(figsize=(8,8))
but it throws error as expected.
How can I increase the size of my histogram figure?
histtype : This parameter is an optional parameter and it is used to draw type of histogram. {'bar', 'barstacked', 'step', 'stepfilled'}
If you've already got the figure created, say it's 'figure 1' (that's the default one when you're using pyplot), you can use figure(num=1, figsize=(8, 6), ...) to change it's size etc.
Python3. figsize() takes two parameters- width and height (in inches). By default the values for width and height are 6.4 and 4.8 respectively. Where, x and y are width and height respectively in inches.
plt.figure(figsize=(8,8)) #change your figure size as per your desire here
n,bins,patch = plt.hist(ser,bins=10, color='green', alpha=0.8, label='Value', edgecolor='orange', linewidth=2)
....
....
To change the background color and the border color:
plt.figure(figsize=(8,8),facecolor='red',edgecolor='blue')
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