Color map jet from center

3 ビュー (過去 30 日間)
Kavish Ram
Kavish Ram 2020 年 10 月 11 日
回答済み: Image Analyst 2020 年 10 月 11 日
Hi,
I am trying to make the colour map 'jet' apper red in the center and go outwards.
I have tried using flipud but it simply inverts it, making the red go at the bottom, so not what I am looking for.
Also,
I am trying to get my lines in the statement
line(x ,y,z, 'LineStyle', '-');
appear in the colormap jet as well. I have tried muiltple times but gives me an error.
Full code :
x = DistanceX .* cos(AngleX);
y = DistanceY .* sin(AngleY);'
z = DistanceZ .* cos(AngleZ) ;
load flujet
figure;
grid on;
scatter3 (x,y,z, [] , z);
line(x ,y,z, 'LineStyle', '-' );
colormap (flipud(jet))
  1 件のコメント
Image Analyst
Image Analyst 2020 年 10 月 11 日
No, that's not the full code. Not only does it throw a syntax error, but there is no assignment oa DistanceX, AngleX, etc. Please post your full code, and include the flujet.mat file (if it's not a built-in one that's shipped with MATLAB).

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

回答 (2 件)

Ameer Hamza
Ameer Hamza 2020 年 10 月 11 日
編集済み: Ameer Hamza 2020 年 10 月 11 日
Something like this?
cm = jet;
cm = circshift(cm, round(size(cm, 1)/2), 1);
image(reshape(cm, 256, 1, []));

Image Analyst
Image Analyst 2020 年 10 月 11 日
Is this what you mean?
% Create colormap with jet where red is at the center and blue is at the ends.
cmap = [jet; flipud(jet)];
% Create a simple image that is a ramp of gray scales.
ramp = uint8(repmat((0:255)', [1, 512]));
% This is what it looks like in gray scale.
subplot(2, 1, 1);
imshow(ramp, 'ColorMap', gray(256))
colorbar
title('This is what it looks like in gray scale.');
% This is what it looks like in pseudocolor.
subplot(2, 1, 2);
imshow(ramp, 'ColorMap', cmap)
colorbar
title('This is what it looks like in pseudocolor.');

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by