mohamed
mohamed

Reputation: 33

How to change axis properties for the imagesc function in matlab

I plotted a 2-D map using imagesc. The x axis should range from -1000 to 1000 "left to right" and Y axis should range from -1000 to a 1000 "bottom to top". When I use imagesc function, the y axis ranges from 1000 to -1000 "bottom to top" which is opposite what I want.any idea of how to fix this.

Upvotes: 0

Views: 1161

Answers (1)

rlbond
rlbond

Reputation: 67749

From the MATLAB help:

By default, imagesc plots the y-axis from lowest to highest value, top to bottom. To reverse this, type set(gca,'YDir','normal'). This will reverse both the y-axis and the image.

You can also use axis xy which does something similar (the default is axis ij which puts the lowest index on top).

Upvotes: 1

Related Questions