I am trying to build an image (using matplotlib.imshow) and a scatter plot in the same drawing. When you try this image, the image is smaller than the scatter plot. The following is a small code example:
import matplotlib.pyplot as plt
import numpy as np
image = np.random.randint(100,200,(200,200))
x = np.arange(0,10,0.1)
y = np.sin(x)
fig, (ax1, ax2) = plt.subplots(1,2)
ax1.imshow(image)
ax2.scatter(x,y)
plt.show()
Which gives the following figure:

How can I get two subwords of the same height? (and apparently width)
I tried using gridspecas shown in this :
fig=plt.figure()
gs=GridSpec(1,2)
ax1=fig.add_subplot(gs[0,0])
ax2=fig.add_subplot(gs[0,1])
ax1.imshow(image)
ax2.scatter(x,y)
But it gives the same result. I also tried to manually adjust the sizes of the subheadings using:
fig = plt.figure()
ax1 = plt.axes([0.05,0.05,0.45,0.9])
ax2 = plt.axes([0.55,0.19,0.45,0.62])
ax1.imshow(image)
ax2.scatter(x,y)
As a result of trial and error, I can get two subtitles to the desired size, although any change in the overall size of the figure will mean that the subtitles will no longer be the same size.
imshow scatter ?
Python 2.7 matplotlib 2.0.0