How to colormap a scatter plot on a map?

조회 수: 10 (최근 30일)
Kamila Turczewski
Kamila Turczewski 2019년 8월 6일
답변: Kojiro Saito 2019년 8월 7일
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')

채택된 답변

Kojiro Saito
Kojiro Saito 2019년 8월 7일
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개)

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by