Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Impossible to display two binary maps with different colors with subplot

Asked by Rems

Rems (view profile)

on 14 Nov 2012

I am typing to plot two binary maps (A & B) with two different color map (map1 is red and map2 is green) in one figure using the subplot command. My codes goes as follow:

subplot(121) imshow(A,map1); subplot(122) imshow(B,map2);

Strangely enough, Matlab always display the two maps in the color of map2. This is not the case when the two maps are displayed in separate figures. How come?

Thanks for your help



Rems (view profile)


No products are associated with this question.

1 Answer

Answer by Walter Roberson

Walter Roberson (view profile)

on 14 Nov 2012
Accepted answer

There is only one colormap per figures.

I recommend you use the FEX contribution "freezeColors"


Walter Roberson

Walter Roberson (view profile)

Contact us