def register_cmap(name=None, cmap=None, data=None, lut=None):
 if (name is None):
  try:
   name = cmap.name
  except AttributeError:
   raise ValueError(u'Arguments must include a name or a Colormap')
 if (not cbook.is_string_like(name)):
  raise ValueError(u'Colormap name must be a string')
 if isinstance(cmap, colors.Colormap):
  cmap_d[name] = cmap
  return
 if (lut is None):
  lut = mpl.rcParams[u'image.lut']
 cmap = colors.LinearSegmentedColormap(name, data, lut)
 cmap_d[name] = cmap

def register_cmap ( name = None , cmap = None , data = None , lut = None ) : if ( name is None ) : try : name = cmap . name except AttributeError : raise ValueError ( u'Arguments must include a name or a Colormap' ) if ( not cbook . is_string_like ( name ) ) : raise ValueError ( u'Colormap name must be a string' ) if isinstance ( cmap , colors . Colormap ) : cmap_d [ name ] = cmap return if ( lut is None ) : lut = mpl . rcParams [ u'image.lut' ] cmap = colors . LinearSegmentedColormap ( name , data , lut ) cmap_d [ name ] = cmap
add a colormap to the set recognized by :func:get_cmap .