Create a specific colormap for a contour plot

52 visualizaciones (últimos 30 días)
Cb
Cb el 18 de Oct. de 2021
Comentada: Kevin Holly el 19 de Oct. de 2021
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')

Respuestas (1)

Kevin Holly
Kevin Holly el 18 de Oct. de 2021
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 comentarios
Cb
Cb el 18 de Oct. de 2021
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 el 19 de Oct. de 2021
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?

Iniciar sesión para comentar.

Categorías

Más información sobre Colormaps en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by