Select axes for zoom in/out

조회 수: 8 (최근 30일)
Mtlb Usr
Mtlb Usr 2011년 2월 10일
I've got a figure with several axes. These axes are parented with a plot of several variables. Also, I've created a popup menu to select which of these axes I want to use. Until here all is OK.
However, when I select the axes and I push the zoom in button, The figure always takes the same axes.

채택된 답변

Walter Roberson
Walter Roberson 2011년 2월 10일
Are you selecting the axes by using
axes(Handle)
If so then when you push the zoom in button you would be making active the axes where the zoom in button itself is.
When you select the axes handle through the popup, record the handle of the selected axes somewhere, and then when you go to do the plot, recall that handle and use it in the plot() call,
plot(AxesHandle, x, y...)
  댓글 수: 3
Mtlb Usr
Mtlb Usr 2011년 2월 11일
Hi Walter,
I tested it but I can't control which axis can zoom in/out.
for example:
ax(1)=axis(....);
ax(2)=axis(....);
hp=plot(ax(1),....);
In this example only I can zoom in ax(2) axis...
regards
Mtlb Usr
Mtlb Usr 2011년 2월 11일
Hi,
Ok, sorry I hadn't seen it. Using, axes(handle), you can control the concret axis.
regards

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

추가 답변 (1개)

Brett Shoelson
Brett Shoelson 2011년 2월 10일
img = imread('cameraman.tif');
f = figure;
ax(1) = subplot(1,2,1);
imshow(img)
ax(2) = subplot(1,2,2);
imshow(im2bw(img,graythresh(img)));
axes(ax(1));
% OR PREFERABLY:
set(f,'currentAxes',ax(1))
%Then:
set(zoom(1.5))% will affect the first axes.
Also: Note that you can programmatically modify the x- y- limits of each axes. For instance:
set(ax(1),'xlim',[1 100],'ylim',[200 300])
AND: You might like to take EXPANDAXES for a test spin. :)
Cheers, Brett

카테고리

Help CenterFile Exchange에서 Data Exploration에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by