How to set a value range for predefined colormap?

Hi!
I want to use a contourf plot with colormap winter. The result is that every plot shows the full color range even it shows just small values. If I want to show one colorbar for two plots with different values I have to set a fixed range of values. I would like to set like 0 is the lowest value (in 'winter' blue) and 20 (in 'winter' yellow) the highest. If one of the plots show maximum values of 5 there shouldn't be any yellow color.
Kind regards
Andreas

回答 (1 件)

Stephen23
Stephen23 2018 年 10 月 8 日

0 投票

Set the caxis:
caxis([0,20])
Note that colormaps do NOT have values associated with them, they are simply a collection of colors in an array.

2 件のコメント

Stephen23
Stephen23 2018 年 10 月 9 日
Andreas Wagner's "Answer" moved here:
Thanks! I knew caxis before, but I used it in the wrong order. Now it works!
Kind regards
Stephen23
Stephen23 2018 年 10 月 9 日
編集済み: Stephen23 2018 年 10 月 9 日
@Andreas Wagner: I hope that it helped.
Remember to accept the answer that helped you to resolve your question.

サインインしてコメントする。

カテゴリ

質問済み:

2018 年 10 月 8 日

編集済み:

2018 年 10 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by