Create a specific colormap for a contour plot
조회 수: 27 (최근 30일)
이전 댓글 표시
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')
댓글 수: 0
답변 (1개)
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
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 Center 및 File Exchange에서 Colormaps에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!