I have two axes let's say A1
and A2
, and on A2
I have an image that displays with imshow
, on A1
I display something entirely different with imagesc
, and it produces a different result color-wise when A2 is used. Here is some example code, likely the shortest example:
a = zeros(1);
[b,bmap] = imread('F.bmp');
c = figure();
d = axes('Parent',c,'Position',[0,0,.5,1]);
e = axes('Parent',c,'Position',[.5,0,.5,1]);
axes(d);
imagesc(a);
pause();
axes(e);
imshow(b,bmap);
pause();
cla(d);
axes(d);
imagesc(a);
figure();
axes();
imagesc(a);
The image a displays differently after b is shown, but when displayed in a different figure it displays normally. How can I fix this?
After digging in I think it is because providing the map,
bmap
toimshow
causes thefigure.Colormap
value to change, so this can be fixed by typingcolormap default
after animshow
command.