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

13 次查看(过去 30 天)
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?

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Colormaps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by