Create real colorbar pictures

2 ビュー (過去 30 日間)
Lev Mihailov
Lev Mihailov 2022 年 6 月 15 日
編集済み: KSSV 2022 年 6 月 15 日
There is a picture and I would like to create a real color bar, where yellow will be the maximum and white the minimum.
clc; close all ; clear all
[fileName1,path,indx] = uigetfile('*.png');
fileName=fullfile(path,fileName1);
fileName
I=imread(fileName)
imshow(I)
thanks in advance

回答 (1 件)

KSSV
KSSV 2022 年 6 月 15 日
編集済み: KSSV 2022 年 6 月 15 日
You can make your colormap using the RGB color code values. Check the below example.
y = [255 255 0]/255 ; % yello RGB value
w = [255 255 255]/255 ; % white RGB value
n = 10 ; % number of variations, can be changed
cmap = [linspace(w(1),y(1),n)' linspace(w(2),y(2),n)' linspace(w(3),y(3),n)'] ;
% USe colormap
Z = peaks(100) ;
surf(Z)
shading interp
colormap(cmap)
colorbar

カテゴリ

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