Colormap not working: is it too long?

3 ビュー (過去 30 日間)
Christopher
Christopher 2015 年 5 月 31 日
コメント済み: Image Analyst 2015 年 6 月 1 日
When I use the following colormap, cmap1, I only get two colors displayed in my figure. Why does Matlab hate my colormap?
cjet = [jet];
njet = numel(cjet(:,1));
c0 = 0.2;
cm = 0.3;
c1 = 1.0;
wn = round(njet*(c1-c0)/(cm-c0)-njet)+1;
stp = 1/(wn-1);
jet2white = [(1-(stp:stp:1)')*0.5 zeros(wn-1,1) zeros(wn-1,1)];
cmap1 = [cjet; jet2white];
figure; imagesc(rand(100,100)); colormap(cmap1); caxis([0 1]);

回答 (1 件)

Image Analyst
Image Analyst 2015 年 5 月 31 日
I get more than 2 colors, but anyway, your cmap1 is 512 rows long. It should be 256 rows long. I believe it just ignores the second 256 rows.
  3 件のコメント
Mike Garrity
Mike Garrity 2015 年 6 月 1 日
The Windows 256 color limitation was removed in R2014b.
Image Analyst
Image Analyst 2015 年 6 月 1 日
Christopher, what operating system and version of MATLAB are you using?

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

カテゴリ

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