set current axis to plot in several subplots
Ältere Kommentare anzeigen
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,
Akzeptierte Antwort
Weitere Antworten (1)
Walter Roberson
am 29 Apr. 2017
imshow(my_image, 'Parent', left_handle)
(you would have to arrange for left_handle to be accessible in your callback.)
Kategorien
Mehr zu Title finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!