Invert y axis on actual data instead of just on the plot


Invert y axis on actual data instead of just on the plot
I have some locations of features that are represented in pixel coordinate space (ie. (0,0) is in the top left corner of the image, and the y axis increases downwards and the x axis increases rightwards).
When I plot these locations in Matplotlib (which by default uses the positive x and positive y quadrant of a cartesian plane) I always run the command
plt.gca().invert_yaxis()
so that the locations of the features look right in the plot.
However, I would like to apply this transformation to the image points themselves, not just in the visualization.
a = np.arange(9).reshape(3,3) …. np.flipud(a) …. is this what you mean?
– NaN
5 mins ago
@NaN kind of but the problem with flipud is that an image point that was originally on the top right of the image would end up on the bottom right inside of on the bottom left
– Carpetfizz
4 mins ago
y = max(y) - y
?– rnso
3 mins ago
y = max(y) - y
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Show your data.
– John Zwinck
9 mins ago