Jet Colormap with black and white at the ends

65 ビュー (過去 30 日間)
AAS
AAS 2020 年 9 月 14 日
編集済み: DGM 2023 年 1 月 15 日
Is there a way to get the jet colormap to have black at its lowest end and white at its highest end instead of blue and red respectively. Just to be clear, I still want the jet colors in the middle of this band.
Thank you!!

回答 (4 件)

Adam Danz
Adam Danz 2020 年 9 月 14 日
編集済み: Adam Danz 2020 年 9 月 14 日
cm = [0 0 0; jet(20); 1 1 1];

Ruger28
Ruger28 2020 年 9 月 14 日
You could just create a colormap, and then add a single row for black and a row for white at the beginning and the end respectively. Is that you you are looking for?
JetMap = colormap(jet);
JetMap = [[0 0 0];JetMap;[1 1 1]];
xvals = [1:66];
yvals = [1:66];
scatter(xvals,yvals,100,JetMap,'filled');

Star Strider
Star Strider 2020 年 9 月 14 日
Try this:
figure
contourf(rand(20))
grid on
colormap([0 0 0;jet(14);1 1 1]) % Append ‘White’ & ‘Black’ To The Ends Of The ‘jet’ Colormap
.

DGM
DGM 2023 年 1 月 15 日
編集済み: DGM 2023 年 1 月 15 日
Observe jet() in RGB:
CT = jet(256);
% plot the channel trajectories (it's simple PWL)
plot(CT(:,1),'r'); hold on
plot(CT(:,2),'g')
plot(CT(:,3),'b')
Replace the last colors at the endpoints with black and white instead of subdued blue and subdued red. Interpolate to form a new CT of the desired length.
% generate a new CT from a list of breakpoints
N = 256; % new CT length
x = [0 1 3 5 7 8]/8;
CT0 = [0 0 0; 0 0 1; 0 1 1; 1 1 0; 1 0 0; 1 1 1];
xf = linspace(0,1,N);
CT = interp1(x,CT0,xf,'linear','extrap');
% plot the channel trajectories (ends are now B/W)
plot(CT(:,1),'r'); hold on
plot(CT(:,2),'g')
plot(CT(:,3),'b')
Try it out
% use the map to plot something
x = linspace(-pi/2,pi/2,30);
y = x.';
z = sin(x).*sin(y);
surf(x,y,z)
colormap(CT)
colorbar
view(-17,50)
See also:

カテゴリ

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