Color map jet from center
조회 수: 3 (최근 30일)
이전 댓글 표시
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
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
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, []));

댓글 수: 0
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.');

댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Blue에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!