To create colors manually and assign them to the marker values, start with the RGB values of last desired color in the shade, say light pink for this example (i.e. [255, 192, 203]) and then scale the values down to [0,1]. These are then used to generate a linearly spaced vector "colors_p" which provides a smoother gradient from red to pink.
geoshow('landareas.shp', 'FaceColor', [0 0 0]);
length = 5;
red = [1, 0, 0];
pink = [255, 192, 203]/255;
colors_p = [linspace(red(1),pink(1),length)', linspace(red(2),pink(2),length)', linspace(red(3),pink(3),length)'];
S=10;
geoshow(randi([-90,90]),randi([-180,180]), 'DisplayType', 'point','marker','^','MarkerEdgeColor','k','MarkerFaceColor',colors_p(1,:),'markersize',S); hold on;
geoshow(randi([-90,90]),randi([-180,180]), 'DisplayType', 'point','marker','^','MarkerEdgeColor','k','MarkerFaceColor',colors_p(2,:),'markersize',S); hold on;
geoshow(randi([-90,90]),randi([-180,180]), 'DisplayType', 'point','marker','^','MarkerEdgeColor','k','MarkerFaceColor',colors_p(3,:),'markersize',S); hold on;
geoshow(randi([-90,90]),randi([-180,180]), 'DisplayType', 'point','marker','^','MarkerEdgeColor','k','MarkerFaceColor',colors_p(4,:),'markersize',S); hold on;
geoshow(randi([-90,90]),randi([-180,180]), 'DisplayType', 'point','marker','^','MarkerEdgeColor','k','MarkerFaceColor',colors_p(5,:),'markersize',S); hold on;
legend('a', 'b', 'c', 'd', 'e', 'Location', 'northwestoutside')
legend('boxoff')
These custom colors can also be applied to "colormap" of any surface plot. See the following example,
surf(peaks)
length = 5;
red = [1, 0, 0];
pink = [255, 192, 203]/255;
colors_p = [linspace(red(1),pink(1),length)', linspace(red(2),pink(2),length)', linspace(red(3),pink(3),length)'];
colormap(colors_p)
Note: Using the "colormapeditor" GUI is a neat way of generating these color vector, since the results can be visually adjusted and modified on the go. For an opened figure, this can be done by changing the number of 'Node Pointers' and adjusting them to desired color values in 'colormapeditor' window.
Best Answer