How to select active axis for zoom in

7 ビュー (過去 30 日間)
Shawn Fernandes
Shawn Fernandes 2018 年 2 月 1 日
回答済み: Shawn Fernandes 2018 年 2 月 1 日
Dear Matlab,
I am able to plot two plots on the same matlab figure successfully.
However, I am not able to select and zoom onto the first created graph, the zoom works on the second plotted graph only.
Please guide on how to make certain axis active, so that the zoom function can work for either plot.
PFB snippet of code for reference.
figure;
subplot(3,1,1);
ax1=gca;
ax1.XColor = 'r';
ax1.YColor = 'r';
ax1_pos=ax1.Position;
ax2=axes('Position',ax1_pos,...
'XAxisLocation','top',...
'YAxisLocation','right',...
'Color','none');
plot(ax1,variable1,'r');
hold on;
plot(ax2,variable2,'g')
Sincerely, Shawn Fernandes
  1 件のコメント
Walter Roberson
Walter Roberson 2018 年 2 月 1 日
Try
uistack(ax2, 'bottom')

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

採用された回答

Shawn Fernandes
Shawn Fernandes 2018 年 2 月 1 日
Hi Walter,
Thanks for the help and support.
I found out that axes(<axesID>) shall make the respective axes active.
Have a nice day.
Sincerely, Shawn Fernandes

その他の回答 (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