Pan a Plotted Curve with a Stationary Plot Behind
1 回表示 (過去 30 日間)
古いコメントを表示
figure;
X = rand(100,1);
Y = rand(100,1);
plot(X,Y);
hold on;
plot(X,sin(Y));
I want to be able to pan the sine curve ONLY. The sine curve can move around the plot but the first plot remain STATIONARY behind.
I wanna do this because I need to just merely compare the shape of the sine curve to the plot behind.
I remember I used to do this before using plotyy or something but I forgot how I achieved that. Anyone has any idea?
Many thanks! =D
採用された回答
Daniel Shub
2011 年 10 月 19 日
I cannot get it to easily work with plotyy, but I think with some work you could. That said, I am not sure there is a real advantage.
X = rand(100,1);
Y = rand(100,1);
minX = min(X);
maxX = max(X);
minY = max([min(Y), min(sin(Y))]);
maxY = max([max(Y), max(sin(Y))]);
figure;
hax(1) = axes;
plot(X, Y, 'b');
axis([minX, maxX, minY, maxY]);
hax(2) = axes;
plot(X, sin(Y), 'r');
axis([minX, maxX, minY, maxY]);
h = pan;
setAllowAxesPan(h, hax(1), false);
set(hax(2), 'Visible', 'Off');
その他の回答 (0 件)
参考
カテゴリ
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!