axes problem in a plot
1 回表示 (過去 30 日間)
古いコメントを表示
how can i solve the problem of this two images automatically without having to fix the axes range for each plot (i have millions of these plots)?
(problem: axis shoud be for x[0 18]) and for y[-6 6]
(problem: the minimum x and minimum y should be bigger)
thank you so much.
0 件のコメント
採用された回答
Matt Fig
2012 年 11 月 15 日
You can set the axes limits to be a certain percent of the data or fixed values, depending on what you want.
x = -pi:.001:pi;
y = sin(x).*x.^2;
plot(x,y)
axis([-5 5 -6 6]) % Use this to set the limits as needed
9 件のコメント
Matt Fig
2012 年 11 月 15 日
編集済み: Matt Fig
2012 年 11 月 15 日
In that case, something like this might be preferable:
x = pi:.001:2*pi;
y = sin(x).*x.^2 + 1;
plot(x,y)
xt = get(gca,'xtick');
dx = xt(2)-xt(1);
yt = get(gca,'ytick');
dy = yt(2) - yt(1);
pause(1)
axis([xt(1) - dx,...
xt(end) + dx,...
yt(1) - dy,...
yt(end) + dy])
Part of the problem is that we could go on forever trying to make your plot look just like you want it to look. I have tried to provide you with some tools to think about, play with, and apply to your particular data.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!