Trouble with Ylim using addaxis
Mostra commenti meno recenti
I can change the Ylim values, but it doesn't change the position of the line on the figure. What am I doing wrong?
Example code:
x = 1:10;
y = x.^2;
figure(1)
plot(x,y)
[hplts,hax2] = addaxis(x,zeros(size(y)),'linewidth',1.5);
% the line is at 0
figure(2)
plot(x,y)
[hplts,hax2] = addaxis(x,zeros(size(y)),'linewidth',1.5);
set(hax2,'Ylim',[0 10]);
% the line is now at 5
Risposte (2)
Catherine
il 16 Lug 2013
Jan
il 12 Lug 2013
Please explain it explicitly, when you use a function, which is not part of Matlab's toolboxes. I guess, that you use FEX: addaxis, but checking this takes some of my time. And downloading this submission to be able to read its instructions is something I do not do to answer a question.
I assume you have to change the limits of the axes the diagram is drawn to:
H = axes('YLim', [0, 10]);
plot(x, y);
[hplts,hax2] = addaxis(x,zeros(size(y)),'linewidth',1.5);
...
3 Commenti
Catherine
il 12 Lug 2013
Jan
il 12 Lug 2013
@Catherine: "does not work" is not explicit enough to understand, if you get an error message or if and how the results differ from your expectations.
All Matlab related questions are welcome in this forum. The less details have to be guessed, the easier and more likely is the creation of a matching answer.
Catherine
il 16 Lug 2013
Categorie
Scopri di più su Desktop 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!