How can I set the colours in contourcmap that the same levels values have same colour in different figures?

1 view (last 30 days)
Dear All, I have two different matrix (rd_pr) which values are categirized in 10 classes by:
>> diff=repmat(NaN,1,length(dif1));
diff(find(-25 > dif1))=1;
diff(find(-15 > dif1 & dif1 >=-25))=2;
diff(find(-5 > dif1 & dif1 >=-15))=3;
diff(find(0 > dif1 & dif1 >=-5))=4;
diff(find(5>dif1& dif1 >= 0))=5;
diff(find(15>dif1& dif1 >= 5))=6;
diff(find(25>dif1& dif1 >= 15))=7;
diff(find(35>dif1& dif1 >= 25))=8;
diff(find(45>dif1& dif1 >= 35))=9;
diff(find(dif1 >= 45))=10;
IU=permute(reshape(diff, 1,464, 201), [1 2 3]);
IU2=permute(IU,[3 2 1]);
I would like to create a contourfm map from these matrices with common colorscale. I tried to do it by:
load coast;
plotm(lat, long, 'k');
clear lat long;
contourfm(latitude,longitude,IU2, 'LevelList',[1,2,3,4,5,6,7,8,9,10]);
contourcmap('jet', 'Colorbar', 'on', 'Location', 'horizontal')
I attched the resulted figures. The higher minimum value (3) in fig 2 has same colour as the lower minimum value (1) in fig 1. How can I set contourcmap that the same values have same colour? Thank you for your help in advance!

Accepted Answer

Szabó-Takács Beáta
Szabó-Takács Beáta on 28 Jun 2016
Meantime I found a solution using with caxis:
load coast;
plotm(lat, long, 'k');
clear lat long;
caxis([1 10])
contourcmap('jet', 'Colorbar', 'on', 'Location', 'horizontal')

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!