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: Find the point in the contour plot that is closest to ``(x, y)``.
  
  This method does not support filled contours.
  
  Parameters
  ----------
  x, y : float
      The reference point.
  indices : list of int or None, default: None
      Indices of contour levels to consider.  If None (the default), all
      levels are considered.
  pixel : bool, default: True
      If *True*, measure distance in pixel (screen) space, which is
      useful for manual contour labeling; else, measure distance in axes
      space.
  
  Returns
  -------
  path : int
      The index of the path that is closest to ``(x, y)``.  Each path corresponds
      to one contour level.
  subpath : int
      The index within that closest path of the subpath that is closest to
      ``(x, y)``.  Each subpath corresponds to one unbroken contour line.
  index : int
      The index of the vertices within that subpath that are closest to
      ``(x, y)``.
  xmin, ymin : float
      The point in the contour plot that is closest to ``(x, y)``.
  d2 : float
      The squared distance from ``(xmin, ymin)`` to ``(x, y)``.
docstr_tok: ["Find","the","point","in","the","contour","plot","that","is","closest","to","``","(","x",",","y",")","``",".","This","method","does","not","support","filled","contours",".","Parameters","--","--","--","--","--","x",",","y",":","float","The","reference","point",".","indices",":","list","of","int","or","None",",","default",":","None","Indices","of","contour","levels","to","consider",".","If","None","(","the","default",")",",","all","levels","are","considered",".","pixel",":","bool",",","default",":","True","If","*","True","*",",","measure","distance","in","pixel","(","screen",")","space",",","which","is","useful","for","manual","contour","labeling",";","else",",","measure","distance","in","axes","space",".","Returns","--","--","--","-","path",":","int","The","index","of","the","path","that","is","closest","to","``","(","x",",","y",")","``",".","Each","path","corresponds","to","one","contour","level",".","subpath",":","int","The","index","within","that","closest","path","of","the","subpath","that","is","closest","to","``","(","x",",","y",")","``",".","Each","subpath","corresponds","to","one","unbroken","contour","line",".","index",":","int","The","index","of","the","vertices","within","that","subpath","that","are","closest","to","``","(","x",",","y",")","``",".","xmin",",","ymin",":","float","The","point","in","the","contour","plot","that","is","closest","to","``","(","x",",","y",")","``",".","d2",":","float","The","squared","distance","from","``","(","xmin",",","ymin",")","``","to","``","(","x",",","y",")","``","."]
code: def find_nearest_contour(self, x, y, indices=None, pixel=True):
      """
      Find the point in the contour plot that is closest to ``(x, y)``.
  
      This method does not support filled contours.
  
      Parameters
      ----------
      x, y : float
          The reference point.
      indices : list of int or None, default: None
          Indices of contour levels to consider.  If None (the default), all
          levels are considered.
      pixel : bool, default: True
          If *True*, measure distance in pixel (screen) space, which is
          useful for manual contour labeling; else, measure distance in axes
          space.
  
      Returns
      -------
      path : int
          The index of the path that is closest to ``(x, y)``.  Each path corresponds
          to one contour level.
      subpath : int
          The index within that closest path of the subpath that is closest to
          ``(x, y)``.  Each subpath corresponds to one unbroken contour line.
      index : int
          The index of the vertices within that subpath that are closest to
          ``(x, y)``.
      xmin, ymin : float
          The point in the contour plot that is closest to ``(x, y)``.
      d2 : float
          The squared distance from ``(xmin, ymin)`` to ``(x, y)``.
      """
      segment = index = d2 = None
  
      with ExitStack() as stack:
          if not pixel:
              # _find_nearest_contour works in pixel space. We want axes space, so
              # effectively disable the transformation here by setting to identity.
              stack.enter_context(
                  self._cm_set(
                      transform=mtransforms.IdentityTransform()
                  )
              )
  
          i_level, i_vtx, (xmin, ymin) = self._find_nearest_contour(
              (x, y), indices
          )
  
      if i_level is not None:
          cc_cumlens = np.cumsum(
              [
                  *map(
                      len,
                      self._paths[i_level]._iter_connected_components(),
                  )
              ]
          )
          segment = cc_cumlens.searchsorted(i_vtx, "right")
          index = (
              i_vtx if segment == 0 else i_vtx - cc_cumlens[segment - 1]
          )
          d2 = (xmin - x) ** 2 + (ymin - y) ** 2
  
      return (i_level, segment, index, xmin, ymin, d2)
  
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 19 for calling the ContourSet obj's underlying member method code with example usage: obj.find_nearest_contour(x, y, indices, pixel) and returns: i_level,  segment,  index,  xmin,  ymin,  d2