axes problem in a plot

2 次查看(过去 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 CenterFile Exchange 中查找有关 Axis Labels 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by