Color map jet from center

3 vues (au cours des 30 derniers jours)
Kavish Ram
Kavish Ram le 11 Oct 2020
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 commentaire
Image Analyst
Image Analyst le 11 Oct 2020
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).

Connectez-vous pour commenter.

Réponses (2)

Ameer Hamza
Ameer Hamza le 11 Oct 2020
Modifié(e) : Ameer Hamza le 11 Oct 2020
Something like this?
cm = jet;
cm = circshift(cm, round(size(cm, 1)/2), 1);
image(reshape(cm, 256, 1, []));

Image Analyst
Image Analyst le 11 Oct 2020
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.');

Catégories

En savoir plus sur Blue dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by