Updating CData of subimage unwantedly resets its colormap
Show older comments
Hi. Below is a class which manages 2 subimages in 1 figure. Both have different colormaps. However, as soon as i try to update the CData of either subimage, its colormap also gets reset. This is not what I want. Instead, I want the colormap to remain the same. Besides redrawing the entire figure, I'm unsure how.
classdef ImageTest
properties
image_1;
image_2;
end
methods
function obj = ImageTest()
figure(1);
subplot(1,2,1);
obj.image_1 = subimage(rand(5)*100, autumn);
subplot(1,2,2);
obj.image_2 = subimage(rand(5)*100, gray);
end
function obj = Change(obj)
set(obj.image_1, 'cdata', rand(5)*100);
drawnow;
end
end
end
Accepted Answer
More Answers (1)
Categories
Find more on Blue in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!