Comments on: Interactively editing a colormap in MATLAB https://blogs.mathworks.com/videos/2013/11/11/interactively-editing-a-colormap-in-matlab/?s_tid=feedtopost Stuart uses video to share his experiences solving problems with MATLAB day-to-day, interesting new features, plus tips and tricks he has picked up along the way. Fri, 06 Dec 2013 05:20:33 +0000 hourly 1 https://wordpress.org/?v=6.2.2 By: Matteo https://blogs.mathworks.com/videos/2013/11/11/interactively-editing-a-colormap-in-matlab/#comment-31640 Fri, 06 Dec 2013 05:20:33 +0000 https://blogs.mathworks.com/videos/?p=1281#comment-31640 Hi Doug

My pedestrian solution takes just a few lines of code. I use the signed most negative and most positive values from the data and sum them. Then I use both the numerical result and its sign to assign the limits automatically. This should anchor the white of the colorbar to zero.

This is a demonstrative pseudocode:

D = maxpos+maxneg
if D >0 % abs (maxpos) > abs (maxneg)
clim=[maxneg (maxpos-D)]
elseif
D <0
clim=[(maxneg-D) maxpos]
end

In your case maxpos=8 and maxneg=-6

]]>