Create a specific colormap for a contour plot

조회 수: 27 (최근 30일)
Cb
Cb 2021년 10월 18일
댓글: Kevin Holly 2021년 10월 19일
Hi I am trying to create a contour plot with my own colormap. However, this only works up to a certain value, after which the colours are no longer output as I had hoped. From 36.8 on, everything is output in the same colour. Does anyone know why this happens?
Levels = [3200 3366 3566 3680 3700 3800]
num_points = diff(Levels);
colors = [ 0.24 0.36 0.56;
0.25 0.56 0.55;
0.45 0.82 0.26;
0.82 0.8 0.19;
0.81 0.61 0.24;
];
map = [];
for i=1:numel(num_points)
map = [map; repmat(colors(i,:), num_points(i), 1)];
end
figure( 'Name', 'untitled fit 1' , 'Colormap', map);
h = plot( fitresult, [xData, yData], zData, 'Style', 'Contour' );
set(h,'LevelList',[23.4 33.6 35.6 36.8 37.0 40] , 'ShowText', 'on')

답변 (1개)

Kevin Holly
Kevin Holly 2021년 10월 18일
Type "colorbar" in the command window to view the colorbar. You can then see the limits of the colormap. You can change the limits with caxis.
Alternatively, you can Select Edit>Colormap... under the Figure menu and set the colormap limits with the Colormap Editor.
  댓글 수: 2
Cb
Cb 2021년 10월 18일
Hi Kevin, thanks for replying!
The caxis version doesn't seem to work.. And you seem to be using a different version of Matlab because I can see the colormap editor but it looks very different and I can't change the size and colorspace.
Do you maybe have another idea?
Kevin Holly
Kevin Holly 2021년 10월 19일
What version of MATLAB are you using? caxis has been around since before 2006. How are you using the function?
Did you enter the min and max limits as such?
caxis([0 100])
What was the range of your colormap?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Colormaps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by