Info

This question is closed. Reopen it to edit or answer.

Create a new figure from figure set of subplotting and keep the color limit

1 view (last 30 days)
Hi,
I built a script that can subplot several figures. And once you right click one of the figures, the program will show the figure you clicked alone on a new figure. The code is as follow:
figure;
for i = 1:6 % the amount of image, I set it to 6 for simplicity.
subplot(2,3,i);
h=imagesc(squeeze(im(:,:,i),'ButtonDownFcn', @newFigure1,[sdmin sdmax]);
% im is a image set. sdmin and sdmax stand for the min/max of clim
set(h,'UserData',i);
end
function newFigure1(h1,~)
switch get(gcf,'SelectionType')
case 'normal'
figure;
data = get(h1, 'CData');
imagesc(data); % I'd like to get the color limit of the original figure so that I can set the color range here
end
end
Now the problem I met is that for each figure in the subplotting, there's a unique sdmin/sdmax. And when I click the figure, the newly created figure will have a different sdmin/sdmax from the original version.
I wonder if there's anyway that I can get the clim of the original figure which is clicked in subplotting?
Thank you very much :)

Answers (0)

Community Treasure Hunt

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

Start Hunting!