現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
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!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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)
