1 year ago
#381491
Luis
matplotlib sharey imshow not aligning
I am trying to plot 2 different size images, side-by-side with aligned y-axis, but it is not working. See example below
import numpy as np
import matplotlib.pyplot as plt
data0 = np.random.randint(0,128, size=(128,256))
data1 = np.random.randint(0,128, size=(128,128))
fig, (ax0,ax1) = plt.subplots(1,2, sharey=True)
ax0.imshow(data0)
ax1.imshow(data1)
plt.show()
And it is showing something like this:
And what I want is that the square image on the left (ysize=128) is made smaller so that the y-axis are perfectly aligned with the image on the left (also ysize=128).
python
matplotlib
imshow
0 Answers
Your Answer