Reputation: 20590
fig = plt.figure(figsize=(10,30))
ax1 = fig.add_subplot(1,1,1)
ax2 = fig.add_subplot(2,1,2)
ax3 = fig.add_subplot(3,1,3)
ax1.imshow(np.ones((100,200,3))) # white
ax2.imshow(np.zeros((100,200,3))) # black
ax3.imshow(np.zeros((100,200,3))) # black
The above code yields the below image
ax1 the white image is where I expected to be. the ax2, ax3, the black images are overlapped with each other
Upvotes: 0
Views: 23
Reputation: 20590
Figured it out! Turns out add_subplot requires the overal dimensions. So the correct way to write it this
fig = plt.figure(figsize=(10,15))
ax1 = fig.add_subplot(3,1,1)
ax2 = fig.add_subplot(3,1,2)
ax3 = fig.add_subplot(3,1,3)
Upvotes: 1