scatterm with scatter marker pink to red color based on values

7 views (last 30 days)
Hello,
Based on another post I have been able to find how create a scatter map with marker size and color based on the data value, but I would like to change the colors to range from light pink to dark red so lump the lower values into pink medium into red and large values into dark red. I have not been able to figure out how to do this. I would appreciate any help, thank you.
This is what I have so far where the colors range from blue to red.
scatterm(lat20,lon20,z20*10,z20,'filled')
  1 Comment
Vesp
Vesp on 29 Jul 2016
Update: I tried the following, but I am getting an error message about scatterm format being incorrect.
C=[1;0.713725;0.756863;1;0;0;0.545098;0;0];
scatterm(lat20,lon20,z20*10,C,'filled');

Sign in to comment.

Answers (1)

Chad Greene
Chad Greene on 31 Jul 2016
You're close. The scatter and scatterm functions link colors to the current colormap of the figure. So you'll have to set the colormap. Using my rgb function it's pretty straightforward:
scatter(rand(100,1),rand(100,1),50,rand(100,1),'filled');
colormap(rgb('light pink','medium pink','dark red'))

Products

Community Treasure Hunt

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

Start Hunting!