MATLAB Answers

Divided colorbar automatically. Stop the blending of colors displayed

219 views (last 30 days)
mashtine
mashtine on 10 Mar 2016
Commented: mashtine on 11 Mar 2016
Hi there,
When I use the colorbar function I get a scale of blended colors and I would like to demarcate each color without having to define each of those colors explicitly. Is there a way to turn off this blending on colors so that I get specific color segments in the colorbar.
I am confused as to why I am having so much trouble finding information on this. Seems fairly simple!

  0 Comments

Sign in to comment.

Accepted Answer

Kelly Kearney
Kelly Kearney on 10 Mar 2016
The default number of colors in a colormap is 64; if you decrease the number of colors, you get more discrete blocks:
colormap(parula(64));
colorbar;
vs
colormap(parula(10));
colorbar;
For more explicit control over color intervals, you might want to check out cptcmap.m

More Answers (1)

Image Analyst
Image Analyst on 10 Mar 2016
No. I think to demarcate each intensity somehow (like a special color, like every 10th gray level is black or whatever), you're going to have to specify the colormap very precisely. Don't be afraid of doing that. I have confidence in you that it's well within your abilities.

Sign in to answer this question.