フィルターのクリア

MATLAB : problem with zoom on 2 courbs (plotyy)

1 回表示 (過去 30 日間)
Sarah Guiffray
Sarah Guiffray 2015 年 6 月 15 日
回答済み: Ingrid 2015 年 6 月 15 日
Hello,
I plot 2 courbs like this : [hAx,handles.hLine1,hLine2] = plotyy(handles.x_new,handles.y4,handles.x_new,handles.y6); And I have a button near the graph to choose the begining of the x-axis with this function :
function changeXmin(handles,~)
handles=guidata(gcf);
xmin = get(handles.xmin_choix,'String');
handles.xmind = datenum(xmin);
set(gca,'xlim', [handles.xmind handles.xmaxd]);
NumTicks = 10;
L = get(gca,'XLim');
set(gca, 'XTick', linspace(L(1),L(2),NumTicks));
guidata(handles.fig, handles);
end
But this is applied only on the first courb handles.y4, my courb handles.y6 stays the same, it is not zoomed. How can I do to zoom on my 2 different courb at the same time ?
Thank you in advance,

採用された回答

Ingrid
Ingrid 2015 年 6 月 15 日
instead of using gca you should store the handle of the axes generated by your plotyy command since two axes are created so you need to change the xlim of both axes
[AX,H1,H2] = plotyy(...)
set(AX(1),'xlim', [handles.xmind handles.xmaxd]);
set(AX(2),'xlim', [handles.xmind handles.xmaxd]);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTwo y-axis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by