Change upper limit of HSV colormap

조회 수: 10 (최근 30일)
newbie9
newbie9 2018년 11월 5일
댓글: newbie9 2018년 11월 6일
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

채택된 답변

newbie9
newbie9 2018년 11월 6일
This actually is what I was looking for; the above answers are helpful for manipulating the HSV matrix, but this by-passes that need: https://www.mathworks.com/help/matlab/ref/jet.html
  댓글 수: 2
Image Analyst
Image Analyst 2018년 11월 6일
jet is a different colormap than hsv so I don't know how this answers your question. It's not merely rotated through hues or changing what color of the hsv colormap is at the top of the colorbar. There are other colormaps like parula, summer, winter, hot, etc.
newbie9
newbie9 2018년 11월 6일
Question was, how to prevent high and low ends from both showing up as red? Trying something other than HSV is an acceptable answer.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Walter Roberson
Walter Roberson 2018년 11월 5일
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
newbie9
newbie9 2018년 11월 5일
편집: newbie9 2018년 11월 5일
That makes sense, thank you for the explanation and advice

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2018년 11월 5일
Try circshift() to rotate the colormap vertically.
  댓글 수: 2
newbie9
newbie9 2018년 11월 5일
I didn't know about circshift(), thank you
Image Analyst
Image Analyst 2018년 11월 5일
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.

댓글을 달려면 로그인하십시오.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by