Keep the graphic's zoom

조회 수: 11 (최근 30일)
Mtlb Usr
Mtlb Usr 2011년 3월 14일
Hi,
I would like to know how I can keep the zoom of graphic when I will go to change the variable that I'm watching at the moment.
thanks
regards
  댓글 수: 6
Mtlb Usr
Mtlb Usr 2011년 3월 16일
Hi Andrew,
Finally, do you know how I can preserve the axis limits after zooming?
thanks
regards
Jan
Jan 2011년 3월 16일
Please anser my question. Keeping the limits and zooming is a contradiction. Therefore you cannot do both.

댓글을 달려면 로그인하십시오.

채택된 답변

Jan
Jan 2011년 3월 14일
Another approach:
y1 = rand(1, 100);
y2 = rand(1, 200) * 2;
AxesH = axes('NextPlot', 'add');
Plot1H = plot(y1);
pause(2.0);
set(AxesH, 'XLimMode', 'manual', 'YLimMode', 'manual');
Plot2H = plot(y2, 'r');
Or you can replace the XData and YData of the plotted line directly instead of the last line:
set(Plot1H, 'XData', 1:200, 'YData', rand(1, 200));
  댓글 수: 7
Jan
Jan 2011년 3월 17일
Perhaps I understand. Did you try my code?
Mtlb Usr
Mtlb Usr 2011년 3월 17일
Hi Jan,
I have could resolve the issue.
I had the answer in frot of me...
The solution has been put the keeplimits arg when I call datetick function.
Sometimes, I think that when you are thinking that you have a big problem, really it's not true because you have a very simple solution for this.
However, thank you for trying to help me.
regards

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Andrew Newell
Andrew Newell 2011년 3월 14일
If I understand your question, you can do something like the following. Make your first plot, for example
plot(1:10)
Zoom in, and then save the values of axis:
v = axis;
Finally, make your next plot and set the axis values.
plot(3:5)
axis(v)

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by