MATLAB Answers

0

How to colormap a scatter plot on a map?

Asked by Kamila Turczewski on 6 Aug 2019
Latest activity Answered by Kojiro Saito on 7 Aug 2019
I'm new to the mapping toolbox on MatLab and was having a hard time finding how to use color map/mapping.
Essentially, I have the coordinates for many different watersheds in the United States and also have the annual rainfall of each watershed. I want to have a map that simply plots each point of the watershed, however I want there to be a color map that shows/distinguishes where higher rainfall amounts were. How do I assign a value to a certain scatter point?
I put a picture of simply the watersheds mapped out. But I hope to have a color bar gradiant on the side so the points have differnt colors depending on the rainfall.
Here is how I mapped it. I have another vector that holds the information in the same order of the lat/long of the rainfall.
latlim = [25 50]; lonlim = [-125 -67];
ax = usamap(latlim, lonlim);
set(ax, 'Visible', 'off')
sheds = shaperead('usastatehi','UseGeoCoords', true, 'BoundingBox', [lonlim', latlim']);
geoshow(ax, sheds, 'FaceColor', [1 1 1])
plotm(lat, long, 'o', 'MarkerFaceColor',[0 .2 .5], 'MarkerSize', 3, 'SelectionHighlight', 'on')

  0 Comments

Sign in to comment.

1 Answer

Answer by Kojiro Saito on 7 Aug 2019
 Accepted Answer

You can control the color by specifying C value in scatterm or geoscatter. If you can share sample rainfall data, I can show a code in detail.

  0 Comments

Sign in to comment.