Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image 放大一个子图,然后在另一个子图中显示_Image_User Interface_Matlab Figure_Matlab Guide - Fatal编程技术网

Image 放大一个子图,然后在另一个子图中显示

Image 放大一个子图,然后在另一个子图中显示,image,user-interface,matlab-figure,matlab-guide,Image,User Interface,Matlab Figure,Matlab Guide,我已经创建了一个GUI,它有两个子绘图。第一个子绘图显示原始图像 当我想放大第一个子图,然后在第二个子图中显示它时,我该怎么办?提前感谢您可以通过将数据从第一个子批次复制到第二个子批次并设置轴限制来完成此操作。下面是一个不使用GUI但应以相同方式工作的示例: figure % create two subplots ax1 = subplot(2,1,1); ax2 = subplot(2,1,2); % display some data in the first subplot axes(

我已经创建了一个GUI,它有两个子绘图。第一个子绘图显示原始图像


当我想放大第一个子图,然后在第二个子图中显示它时,我该怎么办?提前感谢

您可以通过将数据从第一个子批次复制到第二个子批次并设置轴限制来完成此操作。下面是一个不使用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')
生成的图形将如下所示: