Possible Duplicate:
How do I edit the axes of an image in MATLAB to reverse the direction?
The colour image is plotted using the image
function based on some information obtained using imread
function and for the white and blue image basically I am selecting the coordinates of the heat point(red and blue and their variations basically) from the map and then displaying them using plot
function.
The problem is that the plotted values are reversed on the Y axis and I can't figure out how to reverse the Y axis of the plot in order to obtain the same correlation between the images.
Could you please explain me how to solve this problem?
Flipping axis using the Format Axis dialog To do this, we have to right click the y axis that we want to reverse. Then, select the Format Axis from the context menu. The next thing to do is to check the Categories in reverse order. This is found in the Format Axis dialog, in the Axis Options.
In Matlab, the Inverse function is obtained by applying the ' finverse ' command. This command returns the value of the given function variable.
Control the direction of increasing values along the x-axis and y-axis by setting the XDir and YDir properties of the Axes object. Set these properties to either 'reverse' or 'normal' (the default). Use the gca command to access the Axes object. stem(1:10) ax = gca; ax.
B = flip( A , dim ) reverses the order of the elements in A along dimension dim . For example, if A is a matrix, then flip(A,1) reverses the elements in each column, and flip(A,2) reverses the elements in each row.
By default, matlab draws graphs with (0,0) at the bottom left corner. However, it draw images with (0,0) in the top-left corner.
You can change the image axes to standard bottom-left origin by using the command
axis xy;
Remember to make sure that your image is the currently selected figure.
Use rot90()
to rotate the matrix, or a combination or fliplr()
(flips matrix, left and right) and flipud()
(flips matrix up and down) that produced the heat map image.
If you are plotting an image and you don't want to see the axis tic marks you can turn them off with
axis off
if you are interested in changing the direction of either the x-axis and/or y-axis in an axes handle-object, you can use the set function as follows
set(axesHandle,'XDir','rev','YDir','rev')
where you use XDir or YDir (or both) based on the axis you want reversed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With