Trouble with Ylim using addaxis
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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
0 Kommentare
Antworten (2)
Jan
am 12 Jul. 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 Kommentare
Jan
am 12 Jul. 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.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!