class_docstr: Create a new figure for plotting.
  
  A subclass of |Plot| that simplifies plot creation with default axes, grids,
  tools, etc.
  
  Figure objects have many glyph methods that can be used to draw
  vectorized graphical glyphs:
  
  .. hlist::
      :columns: 3
  
      * :func:`~bokeh.plotting.figure.annular_wedge`
      * :func:`~bokeh.plotting.figure.annulus`
      * :func:`~bokeh.plotting.figure.arc`
      * :func:`~bokeh.plotting.figure.asterisk`
      * :func:`~bokeh.plotting.figure.bezier`
      * :func:`~bokeh.plotting.figure.circle`
      * :func:`~bokeh.plotting.figure.circle_cross`
      * :func:`~bokeh.plotting.figure.circle_dot`
      * :func:`~bokeh.plotting.figure.circle_x`
      * :func:`~bokeh.plotting.figure.circle_y`
      * :func:`~bokeh.plotting.figure.cross`
      * :func:`~bokeh.plotting.figure.dash`
      * :func:`~bokeh.plotting.figure.diamond`
      * :func:`~bokeh.plotting.figure.diamond_cross`
      * :func:`~bokeh.plotting.figure.diamond_dot`
      * :func:`~bokeh.plotting.figure.dot`
      * :func:`~bokeh.plotting.figure.ellipse`
      * :func:`~bokeh.plotting.figure.harea`
      * :func:`~bokeh.plotting.figure.harea_step`
      * :func:`~bokeh.plotting.figure.hbar`
      * :func:`~bokeh.plotting.figure.hex`
      * :func:`~bokeh.plotting.figure.hex_tile`
      * :func:`~bokeh.plotting.figure.hstrip`
      * :func:`~bokeh.plotting.figure.hspan`
      * :func:`~bokeh.plotting.figure.image`
      * :func:`~bokeh.plotting.figure.image_rgba`
      * :func:`~bokeh.plotting.figure.image_url`
      * :func:`~bokeh.plotting.figure.inverted_triangle`
      * :func:`~bokeh.plotting.figure.line`
      * :func:`~bokeh.plotting.figure.multi_line`
      * :func:`~bokeh.plotting.figure.multi_polygons`
      * :func:`~bokeh.plotting.figure.patch`
      * :func:`~bokeh.plotting.figure.patches`
      * :func:`~bokeh.plotting.figure.plus`
      * :func:`~bokeh.plotting.figure.quad`
      * :func:`~bokeh.plotting.figure.quadratic`
      * :func:`~bokeh.plotting.figure.ray`
      * :func:`~bokeh.plotting.figure.rect`
      * :func:`~bokeh.plotting.figure.segment`
      * :func:`~bokeh.plotting.figure.square`
      * :func:`~bokeh.plotting.figure.square_cross`
      * :func:`~bokeh.plotting.figure.square_dot`
      * :func:`~bokeh.plotting.figure.square_pin`
      * :func:`~bokeh.plotting.figure.square_x`
      * :func:`~bokeh.plotting.figure.star`
      * :func:`~bokeh.plotting.figure.star_dot`
      * :func:`~bokeh.plotting.figure.step`
      * :func:`~bokeh.plotting.figure.text`
      * :func:`~bokeh.plotting.figure.triangle`
      * :func:`~bokeh.plotting.figure.triangle_dot`
      * :func:`~bokeh.plotting.figure.triangle_pin`
      * :func:`~bokeh.plotting.figure.varea`
      * :func:`~bokeh.plotting.figure.varea_step`
      * :func:`~bokeh.plotting.figure.vbar`
      * :func:`~bokeh.plotting.figure.vstrip`
      * :func:`~bokeh.plotting.figure.vspan`
      * :func:`~bokeh.plotting.figure.wedge`
      * :func:`~bokeh.plotting.figure.x`
      * :func:`~bokeh.plotting.figure.y`
  
  There is a scatter function that can be parameterized by marker type:
  
  * :func:`~bokeh.plotting.figure.scatter`
  
  There are also specialized methods for stacking bars:
  
  * bars: :func:`~bokeh.plotting.figure.hbar_stack`, :func:`~bokeh.plotting.figure.vbar_stack`
  * lines: :func:`~bokeh.plotting.figure.hline_stack`, :func:`~bokeh.plotting.figure.vline_stack`
  * areas: :func:`~bokeh.plotting.figure.harea_stack`, :func:`~bokeh.plotting.figure.varea_stack`
  
  As well as one specialized method for making simple hexbin plots:
  
  * :func:`~bokeh.plotting.figure.hexbin`
  
  In addition to all the ``figure`` property attributes, the following
  options are also accepted:
  
  .. bokeh-options:: FigureOptions
      :module: bokeh.plotting._figure
docstr: Creates a contour plot of filled polygons and/or contour lines.
  
  Filled contour polygons are calculated if ``fill_color`` is set,
  contour lines if ``line_color`` is set.
  
  Args:
      x (array-like[float] of shape (ny, nx) or (nx,), optional) :
          The x-coordinates of the ``z`` values. May be 2D with the same
          shape as ``z.shape``, or 1D with length ``nx = z.shape[1]``.
          If not specified are assumed to be ``np.arange(nx)``. Must be
          ordered monotonically.
  
      y (array-like[float] of shape (ny, nx) or (ny,), optional) :
          The y-coordinates of the ``z`` values. May be 2D with the same
          shape as ``z.shape``, or 1D with length ``ny = z.shape[0]``.
          If not specified are assumed to be ``np.arange(ny)``. Must be
          ordered monotonically.
  
      z (array-like[float] of shape (ny, nx)) :
          A 2D NumPy array of gridded values to calculate the contours
          of.  May be a masked array, and any invalid values (``np.inf``
          or ``np.nan``) will also be masked out.
  
      levels (array-like[float]) :
          The z-levels to calculate the contours at, must be increasing.
          Contour lines are calculated at each level and filled contours
          are calculated between each adjacent pair of levels so the
          number of sets of contour lines is ``len(levels)`` and the
          number of sets of filled contour polygons is ``len(levels)-1``.
  
      **visuals: |fill properties|, |hatch properties| and |line properties|
          Fill and hatch properties are used for filled contours, line
          properties for line contours. If using vectorized properties
          then the correct number must be used, ``len(levels)`` for line
          properties and ``len(levels)-1`` for fill and hatch properties.
  
          ``fill_color`` and ``line_color`` are more flexible in that
          they will accept longer sequences and interpolate them to the
          required number using :func:`~bokeh.palettes.linear_palette`,
          and also accept palette collections (dictionaries mapping from
          integer length to color sequence) such as
          `bokeh.palettes.Cividis`.
code: def contour(
      self,
      x: ArrayLike | None = None,
      y: ArrayLike | None = None,
      z: ArrayLike | np.ma.MaskedArray | None = None,
      levels: ArrayLike | None = None,
      **visuals,
  ) -> ContourRenderer:
      """Creates a contour plot of filled polygons and/or contour lines.
  
      Filled contour polygons are calculated if ``fill_color`` is set,
      contour lines if ``line_color`` is set.
  
      Args:
          x (array-like[float] of shape (ny, nx) or (nx,), optional) :
              The x-coordinates of the ``z`` values. May be 2D with the same
              shape as ``z.shape``, or 1D with length ``nx = z.shape[1]``.
              If not specified are assumed to be ``np.arange(nx)``. Must be
              ordered monotonically.
  
          y (array-like[float] of shape (ny, nx) or (ny,), optional) :
              The y-coordinates of the ``z`` values. May be 2D with the same
              shape as ``z.shape``, or 1D with length ``ny = z.shape[0]``.
              If not specified are assumed to be ``np.arange(ny)``. Must be
              ordered monotonically.
  
          z (array-like[float] of shape (ny, nx)) :
              A 2D NumPy array of gridded values to calculate the contours
              of.  May be a masked array, and any invalid values (``np.inf``
              or ``np.nan``) will also be masked out.
  
          levels (array-like[float]) :
              The z-levels to calculate the contours at, must be increasing.
              Contour lines are calculated at each level and filled contours
              are calculated between each adjacent pair of levels so the
              number of sets of contour lines is ``len(levels)`` and the
              number of sets of filled contour polygons is ``len(levels)-1``.
  
          **visuals: |fill properties|, |hatch properties| and |line properties|
              Fill and hatch properties are used for filled contours, line
              properties for line contours. If using vectorized properties
              then the correct number must be used, ``len(levels)`` for line
              properties and ``len(levels)-1`` for fill and hatch properties.
  
              ``fill_color`` and ``line_color`` are more flexible in that
              they will accept longer sequences and interpolate them to the
              required number using :func:`~bokeh.palettes.linear_palette`,
              and also accept palette collections (dictionaries mapping from
              integer length to color sequence) such as
              `bokeh.palettes.Cividis`.
  
      """
      contour_renderer = from_contour(x, y, z, levels, **visuals)
      self.renderers.append(contour_renderer)
      return contour_renderer
  
imports: from __future__ import annotations
  from typing import TYPE_CHECKING
  import logging
  import numpy
  from ..core.enums import HorizontalLocation, MarkerType, VerticalLocation
  from ..core.properties import Auto, Datetime, Either, Enum, Float, Instance, InstanceDefault, Int, List, Nullable, Object, Seq, String, TextLike, TimeDelta, Tuple
  from ..models import ColumnDataSource, CoordinateMapping, DataRange1d, GraphRenderer, LayoutProvider, Plot, Range, Scale, Tool
  from ..models.dom import Template
  from ..models.tools import Drag, GestureTool, InspectTool, Scroll, Tap
  from ..transform import linear_cmap
  from ..util.options import Options
  from ._graph import get_graph_kwargs
  from ._plot import get_range, get_scale, process_axis_and_grid
  from ._stack import double_stack, single_stack
  from ._tools import process_active_tools, process_tools_arg
  from .contour import ContourRenderer, from_contour
  from .glyph_api import _MARKER_SHORTCUTS, GlyphAPI
label_desc: Use image node_id 14 for calling the figure obj's underlying member method code with example usage: obj.contour(x, y, z, levels) and returns: contour_renderer