Custom Color for Matlab Surface Area

I loaded some topographic data into matlab and created graphs for surfing, surfing and contouring this data, coloring them with a color map. Topographic data range from 0 to 2500 m.

I want to build a map that will color any topography below 200 m, blue, above 500 m red and 200 to 500 m. Can this be done? Can someone give me any advice regarding the team needed for this?

Many thanks

+4
source share
2 answers

You can play with colormapand the fourth entrance surf.

Next chart

enter image description here

it turns out

[X,Y,Z] = peaks(1000);

%colormap
cmap = [0.6 0.2 0.4; 
        0.5 0.5 0.5; 
        0.1 0.9 0.9];  

Zcolor = zeros(size(Z));                   
threshold = 2;
Zcolor(Z <= -threshold)                 = 1;  % first row of cmap
Zcolor(Z > -threshold & Z < threshold)  = 2;  % second row of cmap
Zcolor(Z >= threshold)                  = 3;  % third row of cmap

figure('Color','w');
surf(X, Y, Z, Zcolor, 'EdgeColor', 'None');
colormap(cmap); 
light('Position', [0 -2 1])
+6
hsurf=surf(...)
set(hsurf,'FaceColor','interp')

doc surf .

+2

All Articles