I try to make a figure with different subplots. In the example the left panel is an imshow
image and it is a bit too small. How could I enlarge ax1
? In order to have the colorbar at the level of the x-axes of ax2
and ax3
?
The code and output is:
import matplotlib.pyplot as plt
import numpy as np
fig=plt.figure(figsize=(15,5.5))
ax1=plt.subplot2grid((1,3),(0,0))
ax2=plt.subplot2grid((1,3),(0,1))
ax3=plt.subplot2grid((1,3),(0,2))
image=np.random.random_integers(1,10,size=(100,100))
cax=ax1.imshow(image,interpolation="none",aspect='equal')
cbar=fig.colorbar(cax,ax=ax1,orientation=u'horizontal')
x=np.linspace(0,1)
ax2.plot(x,x**2)
ax3.plot(x,x**3)
plt.show()