using colormap to assign one color for values => 0 and one for < 0

12 visualizaciones (últimos 30 días)
Hi,
I am having no luck using colormap or caxis to set the limits of the two colors on the colorbar. Is there a way (not using the colorbar editor) to easily set values < 0 to blue and values => 0 to red?

Respuesta aceptada

Kelly Kearney
Kelly Kearney el 14 de Nov. de 2014
colormap([0 0 1; 1 0 0]);
set(gca, 'clim', [-1 1]); % or any centered-on-0 limits

Más respuestas (0)

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