Trouble with Ylim using addaxis
古いコメントを表示
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
回答 (2 件)
Catherine
2013 年 7 月 16 日
Jan
2013 年 7 月 12 日
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 件のコメント
Catherine
2013 年 7 月 12 日
Jan
2013 年 7 月 12 日
@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
2013 年 7 月 16 日
カテゴリ
ヘルプ センター および File Exchange で Desktop についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!