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: Select contour levels to span the data.
  
  The target number of levels, *N*, is used only when the
  scale is not log and default locator is used.
  
  We need two more levels for filled contours than for
  line contours, because for the latter we need to specify
  the lower and upper boundary of each range. For example,
  a single contour boundary, say at z = 0, requires only
  one contour line, but two filled regions, and therefore
  three levels to provide boundaries for both regions.
docstr_tok: ["Select","contour","levels","to","span","the","data",".","The","target","number","of","levels",",","*","N","*",",","is","used","only","when","the","scale","is","not","log","and","default","locator","is","used",".","We","need","two","more","levels","for","filled","contours","than","for","line","contours",",","because","for","the","latter","we","need","to","specify","the","lower","and","upper","boundary","of","each","range",".","For","example",",","a","single","contour","boundary",",","say","at","z","=","0",",","requires","only","one","contour","line",",","but","two","filled","regions",",","and","therefore","three","levels","to","provide","boundaries","for","both","regions","."]
code: def _autolev(self, N):
      """
      Select contour levels to span the data.
  
      The target number of levels, *N*, is used only when the
      scale is not log and default locator is used.
  
      We need two more levels for filled contours than for
      line contours, because for the latter we need to specify
      the lower and upper boundary of each range. For example,
      a single contour boundary, say at z = 0, requires only
      one contour line, but two filled regions, and therefore
      three levels to provide boundaries for both regions.
      """
      if self.locator is None:
          if self.logscale:
              self.locator = ticker.LogLocator()
          else:
              self.locator = ticker.MaxNLocator(N + 1, min_n_ticks=1)
  
      lev = self.locator.tick_values(self.zmin, self.zmax)
  
      try:
          if self.locator._symmetric:
              return lev
      except AttributeError:
          pass
  
      # Trim excess levels the locator may have supplied.
      under = np.nonzero(lev < self.zmin)[0]
      i0 = under[-1] if len(under) else 0
      over = np.nonzero(lev > self.zmax)[0]
      i1 = over[0] + 1 if len(over) else len(lev)
      if self.extend in ("min", "both"):
          i0 += 1
      if self.extend in ("max", "both"):
          i1 -= 1
  
      if i1 - i0 < 3:
          i0, i1 = 0, len(lev)
  
      return lev[i0:i1]
  
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 12 for calling the ContourSet obj's underlying member method code with example usage: obj._autolev(N) and returns: lev, lev