Subplots in an "axes" object

68 次查看(过去 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 !

采纳的回答

Walter Roberson
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.
  1 个评论
K BV
K BV 2012-7-2
Thanks for the answer WR.
I could display my images as I wished.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Colormaps 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by