Matrix values represented as colormap

4 ビュー (過去 30 日間)
NeGM
NeGM 2021 年 5 月 25 日
コメント済み: DGM 2021 年 5 月 26 日
Hi everyone,
I am trying to represent the values of a matrix as a colormpap. The problem I am currently having is that this matrix does not have any negative values and I'd like my "colorbar" to represent this as well without altering the way the colormap currelty looks. I'd like my color bar to go from 0 to max(E_superimposed) but when I chnage the "caxis" the colormap gets all distorted. This is the image I am getting from my code: Thank you so much in advance
figure(3)
colormap(flipud(colormap));
set(gcf, 'PaperPosition', [0 0 8 5]);
set(gcf, 'PaperSize', [8 5]);
imagesc(E_superimposed);
caxis([-max(E_superimposed(:)) max(E_superimposed(:))])
colorbar
colormap(lbmap(201,'RedWhiteBlue'))
set(gca,'XTick',[])
set(gca,'YTick',[])
title('Superimposed Block Matrix')

採用された回答

DGM
DGM 2021 年 5 月 25 日
Why do
caxis([-max(E_superimposed(:)) max(E_superimposed(:))])
instead of
caxis([min(E_superimposed(:)) max(E_superimposed(:))])
  6 件のコメント
NeGM
NeGM 2021 年 5 月 26 日
hi DGM, yes thats exactly what I want but I cant get "Blue" to work, how did you modify it?
DGM
DGM 2021 年 5 月 26 日
In the above example, I simply used this function
I don't know how that differs from your version of lbmap().

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2021 年 5 月 25 日
Try
imagesc(E_superimposed);
caxis([0, max(E_superimposed(:))]) % Ignore negative values.
or maybe
cmap = lbmap(201,'RedWhiteBlue')
imshow(E_superimposed, [], 'Colormap', cmap); % Don't use caxis after this.

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by