フィルターのクリア

axes problem in a plot

1 回表示 (過去 30 日間)
joo
joo 2012 年 11 月 15 日
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.

採用された回答

Matt Fig
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
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.
joo
joo 2012 年 11 月 15 日
your code works with my data for 2D but when i work in 3D it doesn't. i will send you my code and excel file by email. if you don't mind to take a few minutes to see the problem, i would be very grateful.
if you can't, thank you very much as well for ALL your help and kindness!
thank you so much.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by