필터 지우기
필터 지우기

From plotyy towards plotxx

조회 수: 7 (최근 30일)
Stefan
Stefan 2015년 2월 12일
편집: Stefan 2015년 2월 19일
Dear reader,
I find plotyy(x,y1,x,y2) very useful mainly due to its ability to simultaneously execute pan/zoom on the 2 represented curves. Specifically, for my needs the x-axis is common while y1 and y2-axis are different. Here is an example:
figure;
x = linspace(0,2*pi,1e3);
y1 = sin(x);
y2 = 2*sin(x);
[AX,H1,H2] = plotyy(x,y1,x,y2); grid on;
set( get(AX(1),'XLabel'),'String','x-axis' );
set( get(AX(1),'YLabel'),'String','y1-axis' );
set( get(AX(2),'YLabel'),'String','y2-axis' );
Notice the x,y1,y2 coordinates get updated simultaneously , when the user pans/zooms on the figure: this is the functionality I am interested in. It allows me to zoom as much as I like on a specific region and precisely know what are the x,y1,y2 coordinates.
Question : how can I achieve the same result in terms of pan/zoom, in the situation where the y-axis is common while x1 and x2 are different? Specifically, this code does almost what I need:
figure;
x1 = linspace(0,2*pi,1e3);
x2 = x1 + 1;
y = sin(x1);
[AX,H1,H2] = plotyy(y,x1,y,x2); grid on;
set( get(AX(1),'XLabel'),'String','y-axis' );
set( get(AX(1),'YLabel'),'String','x1-axis' );
set( get(AX(2),'YLabel'),'String','x2-axis' );
set(AX(1), 'Ydir', 'reverse');
set(AX(2), 'Ydir', 'reverse');
view(-90,90);
This figure represents exactly what I need in terms of visualization of data, however I've lost the previous behavior (functionality) of pan/zoom. For instance when I try to pan, the entire figure moves like a block instead of only the data inside it. Any idea how to regain my pan/zoom functionality?
Thank you.

답변 (0개)

카테고리

Help CenterFile Exchange에서 View and Analyze Simulation Results에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by