10

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?

Smack Alpha
  • 1,828
  • 1
  • 17
  • 37
Deshwal
  • 3,436
  • 4
  • 35
  • 94

2 Answers2

19
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')
vb_rises
  • 1,847
  • 1
  • 9
  • 14
1

I tried doing this though. Adding these 2 lines before my question code

fig=plt.figure(figsize=(8,6))
his=fig.add_axes([0,0,1,1])

``
Deshwal
  • 3,436
  • 4
  • 35
  • 94