Yes it works if I don't include (currently commented out) the caxis line. The issue is the negatives look more extreme since the minimum data value is automatically the darkest blue. It is when I use the caxis([-0.5 0.5]) line (to try to better distribute shading) that I get non-white zero. White ends up being between -2.0 and -3.0 on the color bar (see 'attempted_fix.png'). Thank you!
Change colorbar scale, but keep zero value white
200 views (last 30 days)
I am trying to plot positive data as red (darker red=higher magnitude) and negative data as blue. I want zero to be white. I am using the bluewhitered function to color the data because I could not have another colormap that did this in the matlab choices. But since my data include much higher positive magnitudes than negative values. The negatives look dark blue even at low magnitude. I think the function must make the max and min data values the darkest color end points. I tried to force the negative data to show up lighter blue by using caxis to limit the colors from -0.5 to +0.5 but then zero is not white for some reason. Do you have another idea for a similar color map or a way to fix this one?
I have attached the first plot and my attempted fix.
Here's my code:
%caxis([-0.5 0.5]); % This did not fix it because zero is not white now
x = datenum('July-23-2018'):7:datenum('Oct-5-2018');
set(gca, 'XTick', x);