I have loaded in some topographic data to matlab, and created surf, surfl and contour plots of this data, colouring them using colormap. The topographic data ranges from 0 to 2500 m.
I want to plot a map that colours any topography below 200 m blue, above 500 m red, and between 200 and 500 m green. Is it possible to do this? Could anyone give me any tips regarding the command required to do so?
Many thanks
You may play with colormap and the fourth input of surf.
The following plot

is produced by
[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])
hsurf=surf(...)
set(hsurf,'FaceColor','interp')
doc surf for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With