[GUI] How do change the min and max values of a plot.
Mostra commenti meno recenti
I want to change the min and max values of a plot in GUI.
And the following code doesn't work:
axis(handles.axes1,[0,100,0,1]);
This is because then when I plot a scatter after
scatter(handles.axes1, x, y);
It doesn't keep the same dimensions on the axes.
I then tried hold(handles.axes1);
between the two bits of code and it still doesn't work... confused.
What am I doing wrong?
Risposte (1)
Image Analyst
il 19 Dic 2012
0 voti
Use the xlim() and ylim() functions.
7 Commenti
Shane
il 19 Dic 2012
Matt Fig
il 19 Dic 2012
Shane,
help xlim
Image Analyst
il 19 Dic 2012
What? No! It just changes the min and max value of the axes - the range of values that's viewable in your graph. Just like if you double click the axis in Excel and set the starting and ending tick mark values. Isn't that what you were asking when you asked "change the min and max values of a plot"?
plot() returns a handle to the line you plotted - that doesn't even make sense to send into xlim. You'd use xlim like this:
xlim([0 100]);
if you wanted to show your data in the 0-100 range and did not like whatever range it picked for you automatically.
Shane
il 19 Dic 2012
Walter Roberson
il 19 Dic 2012
hold all
Jan
il 19 Dic 2012
@Shane: Besides Walter's suggestion, what about calling XLIM after all plots have been made?
Shane
il 19 Dic 2012
Categorie
Scopri di più su 2-D and 3-D Plots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!