matlab - Set color of specific values with colormap -
so small version of trying accomplish have matrix a;
a = [0 1 0; 2 0 0;1 3 6;9 0 1]; imagesc(a) so when use imagesc(a) nice grid each value represented different color. want able set value of 0 white , ideally able change other colors see fit such if know 2 values represent same thing 3 , 6, set same or relatively similar colors. imagesc wrong command use because can tell uses color gradient.
thanks
2 options:
- you can create own colormap shown in how create custom colormap programmatically?
or map matrix
amatrix coloured want it. if know want3,6same colour create mapping function makes so. useaindex map 3rd , 6th element of map must same e.g.map = [1, 2, 3, 4, 5, 6, 4, 7, 8, 9, 10]; imagesc(map(a+1))note elements 4 , 7 in
mapsame becauseavalues start0, why there+1in second line.and choose colormap starts white.
personally go method 1.
Comments
Post a Comment