Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matlab - reverse value of axis in plot [duplicate]

Tags:

matlab

Possible Duplicate:
How do I edit the axes of an image in MATLAB to reverse the direction?

enter image description here


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?

like image 649
Simon Avatar asked Jun 21 '11 16:06

Simon


People also ask

How do you reverse the Y axis?

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.

How do you graph inverse in MATLAB?

In Matlab, the Inverse function is obtained by applying the ' finverse ' command. This command returns the value of the given function variable.

How do I change the direction of my axis in MATLAB?

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.

How do you reverse the order of data in MATLAB?

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.


2 Answers

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.

like image 52
hughes Avatar answered Oct 21 '22 19:10

hughes


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.

like image 24
thron of three Avatar answered Oct 21 '22 20:10

thron of three