我想使用matplotlib在Python中并排绘制两个图像。但是我不想创建单独的子图。我想在同一个图中绘制两个图像,以便我可以在两个图像之间绘制对应关系。见下图。
在Matlab中我相信这可以使用imshow([I1,I2])完成,但是matplotlib的python API不接受图像数组。有没有办法在python中执行此操作?
答案 0 :(得分:3)
如果你使用numpy,你可以使用numpy连接函数简单地创建一个代表两个图像的大数组:
import numpy as np
import matplotlib.pyplot as plt
img_A = np.ones((10,10))
img_B = np.ones((10,10))
plot_image = np.concatenate((img_A, img_B), axis=1)
plt.imshow(plot_image)