Change upper limit of HSV colormap
Show older comments
Is there any way to change the upper limit of the HSV colormap (https://www.mathworks.com/help/matlab/ref/hsv.html), so that the high and low aren't both red?
Example application: Data ranges from 1 to 10; values of 1 and 10 both plot as red
Accepted Answer
More Answers (2)
Walter Roberson
on 5 Nov 2018
1 vote
The hsv color map is sorted by first component, which is Hue. It is a feature of hsv hue that hue is an angle in a circle, and since circles circle, both high and low angles are red hues, same as the fact that both 1 degree and 359 degrees are nearly the same place in a circle.
You could sort hsv() with respect to a different column and colormap() the results. Or you could do something like hsv() for twice as many colors as you need and then throw away the last half and colormap() what is left.
1 Comment
Image Analyst
on 5 Nov 2018
1 vote
Try circshift() to rotate the colormap vertically.
2 Comments
newbie9
on 5 Nov 2018
Image Analyst
on 5 Nov 2018
But it works, right?
You can also use caxis() to specify what values in your data correspond to the upper and lower colors. This will allow you to use just a part of the colormap.
Finally, you can just create your own colormap N-by-3 array if you want to use that with the colormap() function.
Categories
Find more on Color and Styling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!