I'm plotting a parameter with a range of 0 to 6. Several of my collaborators have been suggesting to create a colormap to go from red to blue at 1 (the critical point <1 means undersaturated, and >1 means supersaturated) to better illustrate the point.
I wonder what's the best way to achieve this within Matlab?

댓글 수: 2

Leon
Leon 2022년 7월 30일
Many thanks for sharing the link. I'll take a look at it soon.

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

 채택된 답변

Star Strider
Star Strider 2022년 7월 30일

0 개 추천

Another option —
cm = colormap(turbo(6));
cm = colormap(flipud(turbo(6))); % Optional
cb = colorbar;
cbtix = cb.Ticks;
cb.Ticks = linspace(min(cbtix), max(cbtix), 7);
cb.TickLabels = 0:6;
The turbo colormap was introduced in R2020b.
I am not certain how you want it oriented, so use the flipud function to reverse the direction of the colours (as I did here), if necessary.
.

댓글 수: 6

Leon
Leon 2022년 7월 30일
Many thanks! Great to learn of this new function.
Star Strider
Star Strider 2022년 7월 30일
As always, my pleasure!
Leon
Leon 2022년 7월 30일
BTW, how do I change the colormap of Turbo? Right now, the default colormap of Turbo seems to be "jet", which is prohibited by most journals because they are not friendly to people who are colorblind.
Star Strider
Star Strider 2022년 7월 30일
The jet and turbo colormap appearances are similar, however the colour ordering between them is distinctly different. The turbo colormap closely approximates the normal spectral ordering, while jet does not. (I chose turbo because it approximates the behaviour you described as the desired colour order.)
There are several other colormap options available that you can experiment with, depending on the journal requirements.
The two most common varieties of colour vision impairment involve the red-green axis and the blue-yellow axis, so avoiding both of those is going to be a problem!
Leon
Leon 2022년 7월 30일
Many thanks for the explanation!
Star Strider
Star Strider 2022년 7월 30일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Blue에 대해 자세히 알아보기

제품

릴리스

R2022a

태그

질문:

2022년 7월 30일

댓글:

2022년 7월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by