이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
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
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
joo
2012년 11월 15일
here in your code you are fixing values right?
how can i set the axes limits to be a certain percent of the data, as you suggested?
thank you very much.
Matt Fig
2012년 11월 15일
There are several things you could do. One would be to add a certain percent to the endpoints. Another is to add a certain percent to the range. I show the second option here:
x = pi:.001:2*pi;
y = sin(x).*x.^2 + 1;
plot(x,y)
mnx = min(x);
mxx = max(x);
mny = min(y);
mxy = max(y);
dx = mxx-mnx;
dy = mxy-mny;
axis([mnx - .1*dx,...
mxx + .1*dx,...
mny - .1*dy,...
mxy + .1*dy])
joo
2012년 11월 15일
i see... but following your advices, this code shouldn't work? :
grid on;
axis([(min(xxK)*0.120),...
(max(xxK)*0.120),...
(min(zzK)*0.120),...
(max(zzK)*0.120),...
(min(yyK)*0.120),...
(max(yyK)*0.120)])
Matt Fig
2012년 11월 15일
Did you try it? How could I tell if that would work when you have not defined xxK, yyK, zzK etc.? Notice that my example was complete enough for you to copy and paste to examine the results....
joo
2012년 11월 15일
yes, i tried yours and in fact is working perfectly. but i was trying a smaller code. if xxK, yyK, zzK are defined in the workspace isn't it enough? thank you so much.
Matt Fig
2012년 11월 15일
"if xxK, yyK, zzK are defined in the workspace isn't it enough?"
Enough for what? You will get some results, assuming those are real numeric variables, but I still cannot tell if they are the results you want. Only you can tell, because only you can see the data and the results.
Good luck!
ok i understand. but just tell me this last question: when i use your code the axes of the plot produced are not numerated from the beggining? can i fix this?
(in your plot it is almost invisible but for me, as i am working with big numbers the plot shows a big empty space in the axes)
thank you so much.
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
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개)
카테고리
도움말 센터 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
