フィルターのクリア

Is it possible to have a custom color bar?

3 ビュー (過去 30 日間)
BN
BN 2020 年 5 月 3 日
コメント済み: Steven Lord 2020 年 5 月 5 日
Is it possible to have a custom color bar?
Dear all, I have a pre-plotted figure, Is it possible to add a color bar from -25 to 5600.
From light_brown = [0.95 0.9 0.8]; to brown_color = [0.8 0.2 0.1] to it?

採用された回答

Image Analyst
Image Analyst 2020 年 5 月 3 日
Try this:
grayImage = imread('cameraman.tif');
% Rescale image to values -25 to 5600.
grayImage = rescale(double(grayImage), -25, 5600);
imshow(grayImage, []);
light_brown = [0.95 0.9 0.8];
brown_color = [0.8 0.2 0.1];
numColors = 256; % Whatever
redMap = linspace(light_brown(1), brown_color(1), numColors);
greenMap = linspace(light_brown(2), brown_color(2), numColors);
blueMap = linspace(light_brown(3), brown_color(3), numColors);
myColorMap = [redMap(:), greenMap(:), blueMap(:)];
colormap(myColorMap);
colorbar;
caxis([-25, 5600]);
  2 件のコメント
BN
BN 2020 年 5 月 3 日
Amazing, Thank you so much
Steven Lord
Steven Lord 2020 年 5 月 5 日
You may also find the colormapeditor useful in creating custom color maps.

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by