Setting Custom Colors Using imagesc function
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am using imagesc() to look at different sections of a matrix of 0's, 1's, and 2's. Imagesc sets the lowest value (always 0 in this case) to blue, the largest value to red, and the intermediate value to green. Some sections of the matrix have all three values (0,1,2), some have only 0 and 1, and some have only 0 and 2. I want to have set colors for 1 and 2 (0 is always blue). For example, when the section of matrix has only 0 and 1, the 1's show up red. When the section of matrix has only 0 and 2, the 2's show up red. I want the 1's to always show up green and the 2's to always show up red, despite whether there are only 1's or only 2's in the section of matrix. Any suggestions? Thanks.
0 comentarios
Respuestas (1)
Walter Roberson
el 17 de Nov. de 2011
colormap([0 0 1; 0 1 0; 1 0 0]);
image(uint8(YourArray))
0 comentarios
Ver también
Categorías
Más información sobre Color and Styling 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!