pceccon
pceccon

Reputation: 9844

Plotting points after imshow changing image size

I'm trying to run the example provided here, for a custom data.

Calling the same piece of code showed in the given example generates 4 images where the first one is smaller than the others:

plt.subplot(221)
plt.axis('off')
plt.imshow(rs.T, extent=(0,xsteps,0,ysteps), origin='lower')
plt.plot(points[:, 0], points[:, 1], 'k.', ms=1)
plt.title('Original')
plt.subplot(222)
plt.axis('off')
plt.imshow(grid_z0.T, origin='lower')
plt.title('Nearest')
plt.subplot(223)
plt.axis('off')
plt.imshow(grid_z1.T, origin='lower')
plt.title('Linear')
plt.subplot(224)
plt.axis('off')
plt.imshow(grid_z2.T, origin='lower')
plt.title('Cubic')
plt.gcf().set_size_inches(6, 6)
plt.show()

enter image description here

If I comment the plt.plot call after displaying the first image, all plots end having the same size.

I'm wondering how to display the points and keep the same scale for all images.

Upvotes: 1

Views: 496

Answers (1)

rjonnal
rjonnal

Reputation: 1207

Insert plt.autoscale(False) before your call to plt.plot.

Upvotes: 1

Related Questions