This question already has answers here:
Turning y axis upside down in MATLAB
(5 answers)
Closed 9 years ago.
i have a problem with y-axis when i get snapshot from camera,the y-axis start from 450 to 50 ... I want to start from the small number to big number and not vice versa ....could anyone help me to fix this problem.... Thank you
You can change the axis direction using the axis properties:
set(gca,'YDir','reverse') % starts at the top of the figure
set(gca,'YDir','normal') %starts at the bottom of the figure
Related
This question already has an answer here:
How to hide the lines of a graph in MATLAB so that they do not extend beyond the frame
(1 answer)
Closed 1 year ago.
As you can see in the attached image, the line of the graph hangs over the axis, how can I make it not hang over the axis?
A simple approach could be to call something like
ylim([min(y(:))-0.02*range(y(:)) Inf]);
after plotting your data y. The 2% margin may be adjusted to your tastes.
This question already has answers here:
How to plot a circle in Matlab?
(2 answers)
How to plot a filled circle?
(1 answer)
Closed 5 years ago.
I know I can plot a dot and select its size with the word 'markersize' like this
plot(0,0,'.','markersize',50) %Dot centered in (0,0)
The size of the dot produced does not change if we amplify the plot. It always seems to have the same size to our eye. I would like to produce dots (or circles) with a real radius, so that when the image is amplified it appears bigger. What are my options?
Use rectangle command with curvature [1 1] it will draw circles with relative radius.
This question already has answers here:
Turning y axis upside down in MATLAB
(5 answers)
Closed 9 years ago.
Example data:
I can change the values from up to down by the command
B(end:-1:1,:)
I run it and get
However, I want to change the values on the y-axis such that they go from 0 to 180.
How can you change the values on the y-axis in Matlab?
To change direction of y axis, including axis labels and plotted values, you use
set(gca,'YDir','reverse')
When you plot an image, for example using imagesc, the YDir property is automatically set to reverse. So, to change it, set it to normal:
set(gca,'YDir','normal')
This question already has answers here:
Retrieving X and Y values from Matlab Plot
(4 answers)
Closed 9 years ago.
I'm developing a GUI in Matlab that presents a plot (in an axis object). When clicking on a point in the plot, the GUI will open some other plots for that data point.
I added an axis object to my figure and implement the WindowButtonDownFcn to get a button click. I can get the mouse position with
pos=get(hObject,'CurrentPoint');
but how do I convert it to values in my plot? (i.e. which x-value was clicked on)
thanks.
(I'd be happy to hear if there is some simpler way to do this, instead of writing my own GUI)
Try looking up the help on ginput and then set that to some variable. Then plot the points for the number of ginputs you've done.
A lot of it is explained here: http://www.mathworks.com/help/techdoc/ref/ginput.html
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
How do I edit the axes of an image in MATLAB to reverse the direction?
Hey guys,
In MatLab I have a pair of axes where the y-axis starts from (0,0) and counts up to (0,100) with tick marks on this x-axis going 0,1,2,...,100. Can a flip it so it goes 100,99,...,0 so the origin would be (0,100)? Any ideas? I know it's possible because I've seen graph figures like this.
set(gca,'YDir','reverse'); before you draw the graph. Thanks to gary comtois's link - stackoverflow.com/questions/2865600/