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

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

回答(1 个)

Image Analyst
Image Analyst 2012-9-10
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;

类别

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