def shiftedColorMap(cmap, start=<NUM_LIT:0>, midpoint=<NUM_LIT:0.5>, stop=<NUM_LIT:1.0>, name='<STR_LIT>'):
cdict = {<EOL>'<STR_LIT>': [],<EOL>'<STR_LIT>': [],<EOL>'<STR_LIT>': [],<EOL>'<STR_LIT>': []<EOL>}<EOL>reg_index = np.linspace(start, stop, <NUM_LIT>)<EOL>shift_index = np.hstack([<EOL>np.linspace(<NUM_LIT:0.0>, midpoint, <NUM_LIT>, endpoint=False), <EOL>np.linspace(midpoint, <NUM_LIT:1.0>, <NUM_LIT>, endpoint=True)<EOL>])<EOL>for ri, si in zip(reg_index, shift_index):<EOL><INDENT>r, g, b, a = cmap(ri)<EOL>cdict['<STR_LIT>'].append((si, r, r))<EOL>cdict['<STR_LIT>'].append((si, g, g))<EOL>cdict['<STR_LIT>'].append((si, b, b))<EOL>cdict['<STR_LIT>'].append((si, a, a))<EOL><DEDENT>newcmap = LinearSegmentedColormap(name, cdict)<EOL>plt.register_cmap(cmap=newcmap)<EOL>return newcmap<EOL>
Function to offset the "center" of a colormap. Useful for
data with a negative min and positive max and you want the
middle of the colormap's dynamic range to be at zero

Input
-----
  cmap : The matplotlib colormap to be altered
  start : Offset from lowest point in the colormap's range.
      Defaults to 0.0 (no lower ofset). Should be between
      0.0 and `midpoint`.
  midpoint : The new center of the colormap. Defaults to 
      0.5 (no shift). Should be between 0.0 and 1.0. In
      general, this should be  xxxxxx/(vmax + abs(vmin))
      For example if your data range from -15.0 to +5.0 and
      you want the center of the colormap at 0.0, `midpoint`
      should be set to  (1 - 5/(5 + 15)) or 0.75
  stop : Offset from highets point in the colormap's range.
      Defaults to 1.0 (no upper ofset). Should be between
      `midpoint` and 1.0.