set current axis to plot in several subplots
이전 댓글 표시
I have a figure with two subplots I have defined the subplots as:
figure_handle = figure('Tag', 'main_figure');
right_hanlde = subplot(121,...
'Tag','right_plot',...
'Units', 'normalized');
left_handle = subplot(122,...
'Tag', 'left_plot',...
'Units','normalized',...
'Position',[.51 0.03 .496 .917]);
I have a pushbutton that plots my image.
uicontrol('style', 'pushbutton',...
'Units', 'normalized',...
'Position', [.56 .88 .02 .02],...
'String','plot',...
'Callback',@plot_Callback)
function plot_callback(hObject,~)
imshow (my_image);
end
The problem is that if I click anywhere in the right subplot, the current axis is going to be set on the right plot and if I push the plot pushbuttom, it shows my image on the right subplot.
I want to have a line of code in my callback function before "imshow" to set the axis on the right_plot.
Also, the subplot(122) does not work in my case because I have several other properties that by calling subplot() they are all going to be reset.
Thanks,
채택된 답변
추가 답변 (1개)
Walter Roberson
2017년 4월 29일
imshow(my_image, 'Parent', left_handle)
(you would have to arrange for left_handle to be accessible in your callback.)
카테고리
도움말 센터 및 File Exchange에서 Title에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!