파이썬 이미지 여러개 그리기
import numpy as np
import matplotlib.pyplot as plt
width=5
height=5
rows = 2
cols = 2
x=np.linspace(0,3,100)
y1=np.sin(x)
y2=1/(1+np.exp(-x))
figure, axes = plt.subplots(nrows=rows, ncols=cols)
for a, b in enumerate(axes.flat):
image = np.random.randint(7, size=(height,width))
b.imshow(image, alpha=0.25)
r = a // cols
c = a % cols
subtitle="Row:"+str(r)+", Col:"+str(c)
b.set_title(subtitle)
axes[0][1].plot(x, y1)
axes[1][1].plot(x,y2)
figure.tight_layout()
plt.show()
figure, axes = plt.subplots(nrows=2, ncols=2, figsize = (21, 9))
axes[0][0].set_title('sdkflsdkfj')
axes[0][0].plot([1, 2], [3, 10])
plt.title('sdkflsdkfj')
axes[0][1].plot([1, 2], [3, 10])
axes[1][0].plot([1, 2], [3, 10])
axes[1][1].plot([1, 2], [3, 10])
figure.colorbar;
figure.tight_layout()
plt.show()