Heatmap change selected cell color
39 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ilyass Boukhari
el 29 de Nov. de 2020
Comentada: Shubham Rawat
el 3 de Dic. de 2020
How do I change color to specific cells on a heatmap?
The heatmap color is 'autumn', but I need to highlight specific cells with different color
Thank you
0 comentarios
Respuesta aceptada
Shubham Rawat
el 3 de Dic. de 2020
Hi Ilyass,
You can use 'ColorData' property of Heatmap to change the colour of the cells.
Here is example code for that:
h = heatmap([1 3 5; 2 4 6],'Colormap',autumn);
h.ColorData = [4 5 6; 1 2 3];
Hope this Helps!
2 comentarios
Shubham Rawat
el 3 de Dic. de 2020
Hi Ilyass,
The matrix i have given here ([1 3 5; 2 4 6]) is the color indexing in autumn, and there is no black color in autumn colormap.
You may produce colormap of your choice:
mymap = autumn; %mymap is colormap matrix
mymap = [mymap; 0 0 0]; %[0 0 0] is color code for black
h = heatmap([1 2 3; 4 2 1; 5 5 5 ],'Colormap',mymap); % here last row is completely black
Hope This Helps!
Más respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!