class_docstr: Store a set of contour lines or filled regions.
  
  User-callable method: `~.Axes.clabel`
  
  Parameters
  ----------
  ax : `~matplotlib.axes.Axes`
  
  levels : [level0, level1, ..., leveln]
      A list of floating point numbers indicating the contour levels.
  
  allsegs : [level0segs, level1segs, ...]
      List of all the polygon segments for all the *levels*.
      For contour lines ``len(allsegs) == len(levels)``, and for
      filled contour regions ``len(allsegs) = len(levels)-1``. The lists
      should look like ::
  
          level0segs = [polygon0, polygon1, ...]
          polygon0 = [[x0, y0], [x1, y1], ...]
  
  allkinds : ``None`` or [level0kinds, level1kinds, ...]
      Optional list of all the polygon vertex kinds (code types), as
      described and used in Path. This is used to allow multiply-
      connected paths such as holes within filled polygons.
      If not ``None``, ``len(allkinds) == len(allsegs)``. The lists
      should look like ::
  
          level0kinds = [polygon0kinds, ...]
          polygon0kinds = [vertexcode0, vertexcode1, ...]
  
      If *allkinds* is not ``None``, usually all polygons for a
      particular contour level are grouped together so that
      ``level0segs = [polygon0]`` and ``level0kinds = [polygon0kinds]``.
  
  **kwargs
      Keyword arguments are as described in the docstring of
      `~.Axes.contour`.
  
  %(contour_set_attributes)s
class_docstr_tok: ["Store","a","set","of","contour","lines","or","filled","regions",".","User-callable","method",":","`","~.Axes.clabel","`","Parameters","--","--","--","--","--","ax",":","`","~matplotlib.axes.Axes","`","levels",":","[","level0",",","level1",",","...",",","leveln","]","A","list","of","floating","point","numbers","indicating","the","contour","levels",".","allsegs",":","[","level0segs",",","level1segs",",","...","]","List","of","all","the","polygon","segments","for","all","the","*","levels","*",".","For","contour","lines","``","len","(","allsegs",")","==","len","(","levels",")","``",",","and","for","filled","contour","regions","``","len","(","allsegs",")","=","len","(","levels",")","-1","``",".","The","lists","should","look","like",":",":","level0segs","=","[","polygon0",",","polygon1",",","...","]","polygon0","=","[","[","x0",",","y0","]",",","[","x1",",","y1","]",",","...","]","allkinds",":","``","None","``","or","[","level0kinds",",","level1kinds",",","...","]","Optional","list","of","all","the","polygon","vertex","kinds","(","code","types",")",",","as","described","and","used","in","Path",".","This","is","used","to","allow","multiply-","connected","paths","such","as","holes","within","filled","polygons",".","If","not","``","None","``",",","``","len","(","allkinds",")","==","len","(","allsegs",")","``",".","The","lists","should","look","like",":",":","level0kinds","=","[","polygon0kinds",",","...","]","polygon0kinds","=","[","vertexcode0",",","vertexcode1",",","...","]","If","*","allkinds","*","is","not","``","None","``",",","usually","all","polygons","for","a","particular","contour","level","are","grouped","together","so","that","``","level0segs","=","[","polygon0","]","``","and","``","level0kinds","=","[","polygon0kinds","]","``",".","*","*","kwargs","Keyword","arguments","are","as","described","in","the","docstring","of","`","~.Axes.contour","`",".","%","(","contour_set_attributes",")","s"]
docstr: Color argument processing for contouring.
  
  Note that we base the colormapping on the contour levels
  and layers, not on the actual range of the Z values.  This
  means we don't have to worry about bad values in Z, and we
  always have the full dynamic range available for the selected
  levels.
  
  The color is based on the midpoint of the layer, except for
  extended end layers.  By default, the norm vmin and vmax
  are the extreme values of the non-extended levels.  Hence,
  the layer color extremes are not the extreme values of
  the colormap itself, but approach those values as the number
  of levels increases.  An advantage of this scheme is that
  line contours, when added to filled contours, take on
  colors that are consistent with those of the filled regions;
  for example, a contour line on the boundary between two
  regions will have a color intermediate between those
  of the regions.
docstr_tok: ["Color","argument","processing","for","contouring",".","Note","that","we","base","the","colormapping","on","the","contour","levels","and","layers",",","not","on","the","actual","range","of","the","Z","values",".","This","means","we","do","n't","have","to","worry","about","bad","values","in","Z",",","and","we","always","have","the","full","dynamic","range","available","for","the","selected","levels",".","The","color","is","based","on","the","midpoint","of","the","layer",",","except","for","extended","end","layers",".","By","default",",","the","norm","vmin","and","vmax","are","the","extreme","values","of","the","non-extended","levels",".","Hence",",","the","layer","color","extremes","are","not","the","extreme","values","of","the","colormap","itself",",","but","approach","those","values","as","the","number","of","levels","increases",".","An","advantage","of","this","scheme","is","that","line","contours",",","when","added","to","filled","contours",",","take","on","colors","that","are","consistent","with","those","of","the","filled","regions",";","for","example",",","a","contour","line","on","the","boundary","between","two","regions","will","have","a","color","intermediate","between","those","of","the","regions","."]
code: def _process_colors(self):
      """
      Color argument processing for contouring.
  
      Note that we base the colormapping on the contour levels
      and layers, not on the actual range of the Z values.  This
      means we don't have to worry about bad values in Z, and we
      always have the full dynamic range available for the selected
      levels.
  
      The color is based on the midpoint of the layer, except for
      extended end layers.  By default, the norm vmin and vmax
      are the extreme values of the non-extended levels.  Hence,
      the layer color extremes are not the extreme values of
      the colormap itself, but approach those values as the number
      of levels increases.  An advantage of this scheme is that
      line contours, when added to filled contours, take on
      colors that are consistent with those of the filled regions;
      for example, a contour line on the boundary between two
      regions will have a color intermediate between those
      of the regions.
  
      """
      self.monochrome = self.cmap.monochrome
      if self.colors is not None:
          # Generate integers for direct indexing.
          i0, i1 = 0, len(self.levels)
          if self.filled:
              i1 -= 1
              # Out of range indices for over and under:
              if self.extend in ("both", "min"):
                  i0 -= 1
              if self.extend in ("both", "max"):
                  i1 += 1
          self.cvalues = list(range(i0, i1))
          self.set_norm(mcolors.NoNorm())
      else:
          self.cvalues = self.layers
      self.norm.autoscale_None(self.levels)
      self.set_array(self.cvalues)
      self.update_scalarmappable()
      if self.extend in ("both", "max", "min"):
          self.norm.clip = False
  
imports: from contextlib import ExitStack
  import functools
  import math
  from numbers import Integral
  import numpy
  from numpy import ma
  import matplotlib
  from matplotlib import _api, _docstring
  from matplotlib.backend_bases import MouseButton
  from matplotlib.lines import Line2D
  from matplotlib.path import Path
  from matplotlib.text import Text
  import matplotlib.ticker
  import matplotlib.cm
  import matplotlib.colors
  import matplotlib.collections
  import matplotlib.font_manager
  import matplotlib.cbook
  import matplotlib.patches
  import matplotlib.transforms
label_desc: Use image node_id 15 for calling the ContourSet obj's underlying member method code with example usage: obj._process_colors() without return types