get plotyy second axis handle
6 ビュー (過去 30 日間)
古いコメントを表示
I know I can get the second axis handle for plotyy with
[AX,~,~] = plotyy(x1,y1,x2,y2)
and the handle is AX(2) but i use the plotyy function inside another function so AX is deleted because its a local variable
when i use gca (after running the function) in the command window I get what would be AX(1)
So my question is how to get the second axis handle after running the function
0 件のコメント
採用された回答
Paulo Silva
2011 年 4 月 13 日
AX=findall(0,'type','axes');
AX(2) %what you are looking for?!
3 件のコメント
Paulo Silva
2011 年 4 月 14 日
You can compare the handles
AX=findall(0,'type','axes');
if AX(1)==gca
MySecondAxes=AX(2)
else
MySecondAxes=AX(1)
end
MySecondAxes %the handle you are interested in (not the current axes)
その他の回答 (2 件)
Jarrod Rivituso
2011 年 4 月 13 日
This also would work:
secondAxes = findobj('Type','axes','Color','none')
4 件のコメント
参考
カテゴリ
Help Center および File Exchange で Two y-axis についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!