How do you change the background to white in your colorbar?

16 views (last 30 days)
Hi!
I am trying to make movies of electron densities, so I have a colorbar for each frame. However, since my values go from 0 to -9 and I am using "Jet," my background is dark red. How can I turn it to white without manually going in and doing it for every slide?
Thanks!

Answers (1)

Image Analyst
Image Analyst on 10 Sep 2012
Figure out which row is dark red. Then set that row = [1 1 1].
myColorMap = jet(256);
Let's say that your background is say, oh, around -4.5 and the row for that in myColorMap is, say, 128. Then you verify that by looking at the row 128 and see that it is [.5 0 0] which is indeed a dark red. So then you'd just say
myColorMap(128, :) = [1 1 1]; % Set row 128 to white.
% Then apply the colormap
colormap(myColorMap);
colorbar;

Categories

Find more on Colormaps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!