My color map and color bar are not representing the same colors?

7 ビュー (過去 30 日間)
Raghu Piska
Raghu Piska 2019 年 1 月 17 日
編集済み: Luna 2019 年 1 月 17 日
I have a code something like this.
[m,n]=meshgrid(0:el_length_x:XL, 0:el_length_y:YL);
figure
surf(m,n,D3);
colormap jet;
hc=colorbar;
set(hc, 'ylim', [0 1])
shading interp
Capture2223.JPG
Capture23.JPG
my D3 values are closer to 0 as you can see in the figure 2.
My colorbar shows only the brown but my plot shows different colors. How to avoid this?

回答 (1 件)

Luna
Luna 2019 年 1 月 17 日
編集済み: Luna 2019 年 1 月 17 日
It is because your values are close to 0 but you set colorbar limit from [0 1].
That below set would work but I personally don't set colorbar limits and leave it Matlab to do it automatically.
set(hc, 'ylim', [0 0.1])

カテゴリ

Help Center および File ExchangeColormaps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by