Problem with colormaps

Antoine Monmayrant antoine.monmayrant at laas.fr
Wed Feb 8 09:57:54 CET 2012


Hi everyone,

I came across this bug (or at least this annoying behaviour) several 
years ago and got beaten again this morning: the colormap changes when 
you add a plot to a figure and this can alter the way a grayplot or a 
contour is displayed:

//dummy matrix for a grayplot
a=[1,2,3;4,5,6;7,8,9];
h=scf();
h.color_map=hotcolormap(6);
grayplot(1:3,1:3,a);//now we see 4 rectangles: orange, pale yellow, red 
and yellow
//let's add a dummy plot: 1st diagonal in black
plot(1:3,1:3,'k');
//the change of the colormap as affected the way "a" is displayed: 
orange, white, orange, pale yellow
//again let's add a dummy plot: 2nd diagonal in green
plot(1:3,3:-1:1,'g');
//the change of the colormap as affected the way "a" is displayed: 
yellow, white, orange, pale yellow
plot(1:3,2*ones(1:3),'c');
//again: "a" is now yellow, black, orange, white

Any workaround to avoid this and keep my original grayplot unchanged 
when adding some more plots with colors that are not already present in 
the colormap?

Cheers,

Antoine



More information about the users mailing list