class_docstr: Container for colormaps that are known to Matplotlib by name.
  
  The universal registry instance is `matplotlib.colormaps`. There should be
  no need for users to instantiate `.ColormapRegistry` themselves.
  
  Read access uses a dict-like interface mapping names to `.Colormap`\s::
  
      import matplotlib as mpl
      cmap = mpl.colormaps['viridis']
  
  Returned `.Colormap`\s are copies, so that their modification does not
  change the global definition of the colormap.
  
  Additional colormaps can be added via `.ColormapRegistry.register`::
  
      mpl.colormaps.register(my_colormap)
  
  To get a list of all registered colormaps, you can do::
  
      from matplotlib import colormaps
      list(colormaps)
docstr: Register a new colormap.
  
  The colormap name can then be used as a string argument to any ``cmap``
  parameter in Matplotlib. It is also available in ``pyplot.get_cmap``.
  
  The colormap registry stores a copy of the given colormap, so that
  future changes to the original colormap instance do not affect the
  registered colormap. Think of this as the registry taking a snapshot
  of the colormap at registration.
  
  Parameters
  ----------
  cmap : matplotlib.colors.Colormap
      The colormap to register.
  
  name : str, optional
      The name for the colormap. If not given, ``cmap.name`` is used.
  
  force : bool, default: False
      If False, a ValueError is raised if trying to overwrite an already
      registered name. True supports overwriting registered colormaps
      other than the builtin colormaps.
docstr_tok: ["Register","a","new","colormap",".","The","colormap","name","can","then","be","used","as","a","string","argument","to","any","``","cmap","``","parameter","in","Matplotlib",".","It","is","also","available","in","``","pyplot.get_cmap","``",".","The","colormap","registry","stores","a","copy","of","the","given","colormap",",","so","that","future","changes","to","the","original","colormap","instance","do","not","affect","the","registered","colormap",".","Think","of","this","as","the","registry","taking","a","snapshot","of","the","colormap","at","registration",".","Parameters","--","--","--","--","--","cmap",":","matplotlib.colors.Colormap","The","colormap","to","register",".","name",":","str",",","optional","The","name","for","the","colormap",".","If","not","given",",","``","cmap.name","``","is","used",".","force",":","bool",",","default",":","False","If","False",",","a","ValueError","is","raised","if","trying","to","overwrite","an","already","registered","name",".","True","supports","overwriting","registered","colormaps","other","than","the","builtin","colormaps","."]
code: def register(self, cmap, *, name=None, force=False):
      """
      Register a new colormap.
  
      The colormap name can then be used as a string argument to any ``cmap``
      parameter in Matplotlib. It is also available in ``pyplot.get_cmap``.
  
      The colormap registry stores a copy of the given colormap, so that
      future changes to the original colormap instance do not affect the
      registered colormap. Think of this as the registry taking a snapshot
      of the colormap at registration.
  
      Parameters
      ----------
      cmap : matplotlib.colors.Colormap
          The colormap to register.
  
      name : str, optional
          The name for the colormap. If not given, ``cmap.name`` is used.
  
      force : bool, default: False
          If False, a ValueError is raised if trying to overwrite an already
          registered name. True supports overwriting registered colormaps
          other than the builtin colormaps.
      """
      _api.check_isinstance(colors.Colormap, cmap=cmap)
  
      name = name or cmap.name
      if name in self:
          if not force:
              # don't allow registering an already existing cmap
              # unless explicitly asked to
              raise ValueError(
                  f'A colormap named "{name}" is already registered.'
              )
          elif (
              name in self._builtin_cmaps
              and not self._allow_override_builtin
          ):
              # We don't allow overriding a builtin unless privately
              # coming from register_cmap()
              raise ValueError(
                  "Re-registering the builtin cmap "
                  f"{name!r} is not allowed."
              )
  
          # Warn that we are updating an already existing colormap
          _api.warn_external(
              f"Overwriting the cmap {name!r} "
              "that was already in the registry."
          )
  
      self._cmaps[name] = cmap.copy()
      # Someone may set the extremes of a builtin colormap and want to register it
      # with a different name for future lookups. The object would still have the
      # builtin name, so we should update it to the registered name
      if self._cmaps[name].name != name:
          self._cmaps[name].name = name
  
imports: from collections.abc import Mapping
  import functools
  import numpy
  from numpy import ma
  import matplotlib
  from matplotlib import _api, colors, cbook, scale
  from matplotlib._cm import datad
  from matplotlib._cm_listed import cmaps
label_desc: Use image node_id 7 for calling the ColormapRegistry obj's underlying member method code with example usage: obj.register(cmap) without return types