Trouble with Ylim using addaxis
Mostrar comentarios más antiguos
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
Respuestas (2)
Catherine
el 16 de Jul. de 2013
Jan
el 12 de Jul. de 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 comentarios
Catherine
el 12 de Jul. de 2013
Jan
el 12 de Jul. de 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
el 16 de Jul. de 2013
Categorías
Más información sobre Desktop en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!