How do I get a zoomed portion of a plot inside a plot, to enhance the visualization?

조회 수: 208 (최근 30일)
Suppose I have a plot, e.g. some function y(x) and I have plotted it. Now, if I wish to zoom a particular portion on the graph and show the zoomed portion inside the same plot (preferably by making a small box), is there any tool to do that with less computation (some GUI, etc.)?
  댓글 수: 3
Abhinav Sinha
Abhinav Sinha 2018년 3월 18일
No, I do not need a subplot. This needs to be done in the same plot. Something like this, which I have done by creating a box of some dimension and then placing it in a suitable position.
Yamina chbak
Yamina chbak 2021년 9월 11일
Did you find how to do that ? because i need it too.

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

채택된 답변

Ahmet Cecen
Ahmet Cecen 2018년 3월 18일
편집: Ahmet Cecen 2018년 3월 18일
I am giving you the framework that you can use to do this the way you want. Every component of what you asked is there, they are just either placed or formatted differently. Tweaking and formatting is up to you.
r1 = [1:100]'.*rand(100,1);
figure;
a1 = axes();
plot(a1,r1);
a2 = axes();
a2.Position = [0.3200 0.6600 0.2 0.2]; % xlocation, ylocation, xsize, ysize
plot(a2,r1(50:70)); axis tight
annotation('ellipse',[.2 .3 .2 .2])
annotation('arrow',[.1 .2],[.1 .2])
legend(a1,'u')

추가 답변 (1개)

Junaid Qadir
Junaid Qadir 2019년 3월 7일
How can I zoom the subplot within same plot?

카테고리

Help CenterFile Exchange에서 Two y-axis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by