Subplots in an "axes" object
67 次查看(过去 30 天)
显示 更早的评论
Hi,
I would like to sublot four images (X(:,:,1) -> X(:,:,4)) in an "axes" object (axes1) but every time I have one image displayed and not the totality of the images.
Here is the part of my code which nomally should do that :
if(1<=nb_coupes)
axes(handles.axes1)
subplot(121)
imagesc(X(:,:,1)), colormap gray, axis('image'),axis('off'),colormap gray,zoom(2);
setappdata (Feature_Tracking,'images',X);
end
if(2<=nb_coupes)
hold on
subplot(122)
imagesc(X(:,:,2)), colormap gray, axis('image'),axis('off'),colormap gray,zoom(2);
setappdata (Feature_Tracking,'images',X);
end
if(3<=nb_coupes)
hold on
subplot(211)
imagesc(X(:,:,3)), colormap gray, axis('image'),axis('off'),colormap gray,zoom(2);
setappdata (Feature_Tracking,'images',X);
end
set(handles.axes1,'String',FileName)
axes(handles.axes1)
imagesc(X(:,:,1)), colormap gray, axis off, axis image
setappdata (Feature_Tracking,'images',X);
Would you please help me solving the problem ?
Thank you in advance !
0 个评论
采纳的回答
Walter Roberson
2012-6-27
You cannot do this. subplot() creates new axes for the plots, and cannot plot inside an axes.
See also this part of the subplot documentation:
If a subplot specification causes a new axis to overlap a existing axis, the existing axis is deleted - unless the position of the new and existing axis are identical. For example, the statement subplot(1,2,1) deletes all existing axes overlapping the left side of the figure window and creates a new axis on that side—unless there is an axes there with a position that exactly matches the position of the new axes (and 'replace' was not specified), in which case all other overlapping axes will be deleted and the matching axes will become the current axes.
For displaying multiple images in the same axes, see http://www.mathworks.com/matlabcentral/answers/41928-display-multiple-images-on-single-axes
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Colormaps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!