python - Change range withouth scaling in matplot -
i have question, making program displays zoomed area of peru axis shown in range of image (e.g. 7000x7500) want in utm range (e.g. x-axis between 500000-600000 , y-axis 9500000-9700000) have tried using plt.set_xlim
, plt.sety_lim
no success, think have use plt.autoscale(false)
didn't work or used wrong.
i create figure , axes out of main program
f = plt.figure(figsize=(5,5)) axe = f.add_axes([0, 0, 1, 1])
this function call everytime want plot
def plotear(self, mapa): axe.clear() axe.imshow(mapa, cmap='gray', interpolation='nearest') axe.set_xlim(0,10000) #this testing axe.set_ylim(0,10000) #this testing plt.autoscale(false) self.canvas.draw()
from imshow
documentation you'd find there argument extent
can used scale image.
extent
: scalars (left, right, bottom, top), optional, default: none
location, in data-coordinates, of lower-left , upper-right corners. if none, image positioned such pixel centers fall on zero-based (row, column) indices.
in case you'd use
ax.imshow(mapa, extent=[5e5, 6e5, 9.5e6, 9.7e6])
Comments
Post a Comment