Linkaxes background image disappears
Show older comments
Hi,
I'm looking to overlap two images, each with their own colormap. I've seen tons of answers talking about drawing them on separate axes and then linking them. However, every time I do, the 'background image' disappears. Can anyone help?
Here is my code:
hf = figure;
h1 = axes('Parent',hf);
Array = imread('background.jpg');
image(h1,Array(:,:,[1 1 1]));
[item,map] = imread('foreground.gif');
h2 = axes('Parent',hf);
image(h2,item);
linkaxes([h1 h2])
colormap(h2,map)
If you go through the code with your own image files, you'll notice that the Array image disappears as soon as I create the second axes. Although even creating the axes first and then uploading an image doesn't make a difference. What am I missing?
Thanks!
PS> It's not an animated .gif, it's just an image file, but this is how they were delivered to me.
Accepted Answer
More Answers (0)
Categories
Find more on Color and Styling 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!