Display the entire image by clicking on the subtitle

I selected some parts of the images and displayed them on the same figure with subtitles. The number of subplots is not determined. I read images from a file and then crop them. My goal is that when I click or double-click on a subtitle, I want to see the whole image in a new picture.

I want to give an example to clearly state my question. if I click on the first subplot, I want to see the image of the entire operator in a new figure.

enter image description here

Is it possible? If possible, what is the way?

+2
source share
1 answer

ButtonDownFcn, Matlab. "interactivePlot".

list_of_images , . . , subplot...

function interactivePlot
    list_of_images = {rand(5), rand(10), rand(50), rand(100)}

    for ii = 1:length(list_of_images)
        subplot(2,2,ii)
        imagesc(list_of_images{ii}, 'ButtonDownFcn', @newFigure1)
    end
end

function newFigure1(h1, h2)
    figure()
    data = get(h1, 'CData');
    imagesc(data)
end    
+4

All Articles