フィルターのクリア

scaling and change the ylim for subplot

37 ビュー (過去 30 日間)
Ravindra
Ravindra 2020 年 9 月 7 日
編集済み: Abdolkarim Mohammadi 2020 年 9 月 7 日
I plotted a figure with two y-axis with different y limit
But I would like to limit the yyaxis of the right axis so that right axis starts with the lower limit of the left plot and upper limit of the right plot?
Or if it is possible that the zero-axis of both plots matches?
I manually shifted the right plotted axis so that the zeros matches for both axis.
Thank you very much for your inputs!!

採用された回答

Abdolkarim Mohammadi
Abdolkarim Mohammadi 2020 年 9 月 7 日
編集済み: Abdolkarim Mohammadi 2020 年 9 月 7 日
You should set ylim() for each axes separately. For example:
x = linspace (0, 6, 51)';
y1 = sin (x);
y2 = cos (x);
yyaxis ('left');
plot (x,y1);
ylim ([-2,2]);
yyaxis ('right');
plot (x,y2);
ylim ([-6,6]);
  4 件のコメント
Ravindra
Ravindra 2020 年 9 月 7 日
編集済み: Ravindra 2020 年 9 月 7 日
Thanks!!!
So every time I need to modify the ylim manually so that it passes with the left side axis. Is it possible to do it automatically?
Abdolkarim Mohammadi
Abdolkarim Mohammadi 2020 年 9 月 7 日
編集済み: Abdolkarim Mohammadi 2020 年 9 月 7 日
ylim() only affects the current axis. When the command yyaxis(AA,'right') is executed, all of the future commands (including ylim()) affect the right yyaxis. You have to do this manually because the scale of your data for the left yyaxis and the right yyaxis differs significantly. The left yyaxis and the right yyaxis are separate and the ruler scale in one side does not affect the one on the other side.

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

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by