MATLAB Answers

0

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

Asked by mashtine on 14 Nov 2014
Latest activity Answered by Kelly Kearney
on 14 Nov 2014
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?

  0 Comments

Sign in to comment.

1 Answer

Answer by Kelly Kearney
on 14 Nov 2014
 Accepted Answer

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

  0 Comments

Sign in to comment.