Question about axes using GUI in MATLAB
Show older comments
I have a GUI with one object: axes and a pushbutton. When pressing the pushbutton, I would like to display on the axes several images. I tried to use subplots but it doesn’t seem to cope: the images go all over the GUI window and not just where the axes are.
Here is the code for my pushbutton:
axes(handles.ManyImage);
subplot(2,2,1);
RGB1 = imread('Image1.TIF');
imagesc(RGB1);
axis off
subplot(2,2,2);
RGB2 = imread('Image2.TIF');
imagesc(RGB2);
axis off
subplot(2,2,3);
RGB3 = imread('Image3.TIF');
imagesc(RGB3);
axis off
I attached the illustrations of my problem.
Thank you for the help!
8 Comments
Salaheddin Hosseinzadeh
on 26 Aug 2014
Try not turning off the axis
axis off
I don't think if that's the correct way of disappearing the axis.
Angelina
on 26 Aug 2014
Ben11
on 26 Aug 2014
Are all of your images the same size?
Angelina
on 26 Aug 2014
Michael Haderlein
on 26 Aug 2014
Edited: Michael Haderlein
on 26 Aug 2014
Subplots are individual axes. You just created subplots (axes) on top of the first axes. They overlap, but they are not connected to each other. If you want axes inside a container, you can create a uipanel object and set the parent property of the axes (subplots) to the uipanel handle. As the positions are normalized by default, you can then just set the panel's position and the axis will follow.
Angelina
on 26 Aug 2014
Michael Haderlein
on 26 Aug 2014
Yes, as far as I got your request, you want to have multiple images displayed but the axes should not be distributed all over the figure. Then create the uipanel, put it where you want, and put one axes per image into this panel.
Angelina
on 26 Aug 2014
Accepted Answer
More Answers (0)
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!