matplotlib sharey imshow不对齐
我正在尝试绘制2个不同尺寸的图像,并与对齐的Y轴并排并排,但它不起作用。请参阅下面的示例
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()
,它显示了类似的内容:
,我想要的是使左侧的平方图像(ysize = 128)变小,以使y轴完全与图像完美地对齐左(也ysize = 128)。
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).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论