Change Range Withouth Scaling In Matplot
I have a question, I am making a program that displays a zoomed area of Peru but the axis shown are in the range of the image (e.g. 7000x7500) but i want to be in UTM range (e.g.
Solution 1:
From the imshow
documentation you'd find that there is an argument extent
which can be used to scale the image.
extent
: scalars (left, right, bottom, top), optional, default: None The location, in data-coordinates, of the lower-left and upper-right corners. If None, the image is positioned such that the pixel centers fall on zero-based (row, column) indices.
In this case you'd use it like
ax.imshow(mapa, extent=[5e5, 6e5, 9.5e6, 9.7e6])
Answer to the edited question: In the case of the image being too large, this is probably caused by you setting
axe = f.add_axes([0, 0, 1, 1])
. You should rather use ax = fig.add_subplot(111)
and if the margins are not as you want then, setting plt.subplots_adjust( ... )
with the respective spacings.
Post a Comment for "Change Range Withouth Scaling In Matplot"