Matrix scale range

I have a question, I am making a program that displays an enlarged area of ​​Peru, but the specified axis is in the image range (for example, 7000x7500), but I want to be in the UTM range (for example, the x axis between 500000 -600000 and y axis 9500000-9700000 ) I tried to use plt.set_xlimand plt.sety_lim, but did not succeed, I think I need to use plt.autoscale(False), but it also did not work or I used it incorrectly.

I create a figure and axes from the main program

f = plt.figure(figsize=(5,5))
axe = f.add_axes([0, 0, 1, 1])

this is the function that I call every time I want to build

def plotear(self, mapa):

    axe.clear()
    axe.imshow(mapa, cmap='gray', interpolation='nearest')
    axe.set_xlim(0,10000) #This is just for testing
    axe.set_ylim(0,10000) #This is just for testing
    plt.autoscale(False)
    self.canvas.draw()
0
source share
1 answer

imshow , extent, .

extent: (, , , ), , :
. "", , (, ).

ax.imshow(mapa, extent=[5e5, 6e5, 9.5e6, 9.7e6])
0

Source: https://habr.com/ru/post/1016445/


All Articles