MATLAB Answers

Can I assign specific colors to values for an imagesc plot and use a colormap for others?

1 view (last 30 days)
Heidi Hirsh
Heidi Hirsh on 2 Nov 2020
I am trying to make a map using imagesc. I have different classes of data I need to show. Right now I am using a default colormap (I think it is parula) to color the value of each pixel. I want to manually assign the colors for certain values if possible. The classes are as follows:
0 to 1.5= ratio of kelp cover (0 is open water)
3=land
-1=error
-2=cloud cover (also open ocean beyond the coastal area I am interested in)
I want to still be able to see the ratio of kelp cover on a colorbar scale but I want to make the error and cloud classes easier to distinguish (for example, a bright color - maybe red - for the error class and white for cloud).
I found some similar questions and answers online but for the custom colorbars people had discrete values assigned for each value. I'm not sure what to do since I need the kelp color classes (0-1.5) to to scale with the color. Does that make sense?
I am attaching sample map data (data.mat).
imagesc(kelp_may) %plots the kelp cover as I am doing it now

Answers (0)

Community Treasure Hunt

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

Start Hunting!