0
2 개의 서브 도표가있는 GUI를 만들었습니다. 첫 번째는 원래의 이미지를 표시합니다.하나의 서브 플롯을 확대 한 다음 다른 서브 플롯에 표시
첫 번째 서브 플롯을 확대 한 다음 두 번째 서브 플롯에 표시하려면 어떻게해야합니까? 미리 감사드립니다.
2 개의 서브 도표가있는 GUI를 만들었습니다. 첫 번째는 원래의 이미지를 표시합니다.하나의 서브 플롯을 확대 한 다음 다른 서브 플롯에 표시
첫 번째 서브 플롯을 확대 한 다음 두 번째 서브 플롯에 표시하려면 어떻게해야합니까? 미리 감사드립니다.
첫 번째 서브 플로트에서 두 번째 서브 플로트로 데이터를 복사하고 축 제한을 설정하면됩니다.
: 결과 그림은 다음과 같이 보일 것입니다figure
% create two subplots
ax1 = subplot(2,1,1);
ax2 = subplot(2,1,2);
% display some data in the first subplot
axes(ax1);
imagesc(spiral(10));
% get the range of the axes in the first subplot
xLim1 = get(ax1, 'XLim');
yLim1 = get(ax1, 'YLim');
% Ask the user to zoom in. Instead of pressing
% enter, there could be a button to push in
% a GUI
reply = input('Zoom in and press enter');
% Get the new, zoomed in axes
zoomedXLim = get(ax1, 'XLim');
zoomedYLim = get(ax1, 'YLim');
% get the data from the first axis and display
% it in the second axis.
data = getimage(ax1);
axes(ax2)
imagesc(data)
% set the second axis to the zoomed range
set(ax2, 'XLim', zoomedXLim)
set(ax2, 'YLim', zoomedYLim)
title('zoomed image')
% return the first axis to its original range.
set(ax1, 'XLim', xLim1)
set(ax1, 'YLim', yLim1)
axes(ax1)
title('original image')
: 다음은 GUI를 사용하지 않고 같은 방식으로 작동합니다 예입니다