class_docstr: Utility renderer using Bokeh to render a grid of plots over the same (x, y) range.
  
  Args:
      nrows (int, optional): Number of rows of plots, default ``1``.
      ncols (int, optional): Number of columns of plots, default ``1``.
      figsize (tuple(float, float), optional): Figure size in inches (assuming 100 dpi), default
          ``(9, 9)``.
      show_frame (bool, optional): Whether to show frame and axes ticks, default ``True``.
      want_svg (bool, optional): Whether output is required in SVG format or not, default
          ``False``.
  
  Warning:
      :class:`~contourpy.util.bokeh_renderer.BokehRenderer`, unlike
      :class:`~contourpy.util.mpl_renderer.MplRenderer`, needs to be told in advance if output to
      SVG format will be required later, otherwise it will assume PNG output.
class_docstr_tok: ["Utility","renderer","using","Bokeh","to","render","a","grid","of","plots","over","the","same","(","x",",","y",")","range",".","Args",":","nrows","(","int",",","optional",")",":","Number","of","rows","of","plots",",","default","``","1","``",".","ncols","(","int",",","optional",")",":","Number","of","columns","of","plots",",","default","``","1","``",".","figsize","(","tuple","(","float",",","float",")",",","optional",")",":","Figure","size","in","inches","(","assuming","100","dpi",")",",","default","``","(","9",",","9",")","``",".","show_frame","(","bool",",","optional",")",":","Whether","to","show","frame","and","axes","ticks",",","default","``","True","``",".","want_svg","(","bool",",","optional",")",":","Whether","output","is","required","in","SVG","format","or","not",",","default","``","False","``",".","Warning",":",":","class",":","`","~contourpy.util.bokeh_renderer.BokehRenderer","`",",","unlike",":","class",":","`","~contourpy.util.mpl_renderer.MplRenderer","`",",","needs","to","be","told","in","advance","if","output","to","SVG","format","will","be","required","later",",","otherwise","it","will","assume","PNG","output","."]
docstr: Plot quad grid lines on a single plot.
  
  Args:
      x (array-like of shape (ny, nx) or (nx,)): The x-coordinates of the grid points.
      y (array-like of shape (ny, nx) or (ny,)): The y-coordinates of the grid points.
      ax (int or Bokeh Figure, optional): Which plot to use, default ``0``.
      color (str, optional): Color to plot grid lines, default ``"black"``.
      alpha (float, optional): Opacity to plot lines with, default ``0.1``.
      point_color (str, optional): Color to plot grid points or ``None`` if grid points
          should not be plotted, default ``None``.
      quad_as_tri_alpha (float, optional): Opacity to plot ``quad_as_tri`` grid, default
          ``0``.
  
  Colors may be a string color or the letter ``"C"`` followed by an integer in the range
  ``"C0"`` to ``"C9"`` to use a color from the ``Category10`` palette.
  
  Warning:
      ``quad_as_tri_alpha > 0`` plots all quads as though they are unmasked.
docstr_tok: ["Plot","quad","grid","lines","on","a","single","plot",".","Args",":","x","(","array-like","of","shape","(","ny",",","nx",")","or","(","nx",",",")",")",":","The","x-coordinates","of","the","grid","points",".","y","(","array-like","of","shape","(","ny",",","nx",")","or","(","ny",",",")",")",":","The","y-coordinates","of","the","grid","points",".","ax","(","int","or","Bokeh","Figure",",","optional",")",":","Which","plot","to","use",",","default","``","0","``",".","color","(","str",",","optional",")",":","Color","to","plot","grid","lines",",","default","``","``","black","''","``",".","alpha","(","float",",","optional",")",":","Opacity","to","plot","lines","with",",","default","``","0.1","``",".","point_color","(","str",",","optional",")",":","Color","to","plot","grid","points","or","``","None","``","if","grid","points","should","not","be","plotted",",","default","``","None","``",".","quad_as_tri_alpha","(","float",",","optional",")",":","Opacity","to","plot","``","quad_as_tri","``","grid",",","default","``","0","``",".","Colors","may","be","a","string","color","or","the","letter","``","``","C","''","``","followed","by","an","integer","in","the","range","``","``","C0","''","``","to","``","``","C9","''","``","to","use","a","color","from","the","``","Category10","``","palette",".","Warning",":","``","quad_as_tri_alpha",">","0","``","plots","all","quads","as","though","they","are","unmasked","."]
code: def grid(
      self,
      x: ArrayLike,
      y: ArrayLike,
      ax: figure | int = 0,
      color: str = "black",
      alpha: float = 0.1,
      point_color: str | None = None,
      quad_as_tri_alpha: float = 0,
  ) -> None:
      """Plot quad grid lines on a single plot.
  
      Args:
          x (array-like of shape (ny, nx) or (nx,)): The x-coordinates of the grid points.
          y (array-like of shape (ny, nx) or (ny,)): The y-coordinates of the grid points.
          ax (int or Bokeh Figure, optional): Which plot to use, default ``0``.
          color (str, optional): Color to plot grid lines, default ``"black"``.
          alpha (float, optional): Opacity to plot lines with, default ``0.1``.
          point_color (str, optional): Color to plot grid points or ``None`` if grid points
              should not be plotted, default ``None``.
          quad_as_tri_alpha (float, optional): Opacity to plot ``quad_as_tri`` grid, default
              ``0``.
  
      Colors may be a string color or the letter ``"C"`` followed by an integer in the range
      ``"C0"`` to ``"C9"`` to use a color from the ``Category10`` palette.
  
      Warning:
          ``quad_as_tri_alpha > 0`` plots all quads as though they are unmasked.
      """
      fig = self._get_figure(ax)
      x, y = self._grid_as_2d(x, y)
      xs = [row for row in x] + [row for row in x.T]
      ys = [row for row in y] + [row for row in y.T]
      kwargs = dict(line_color=color, alpha=alpha)
      fig.multi_line(xs, ys, **kwargs)
      if quad_as_tri_alpha > 0:
          # Assumes no quad mask.
          xmid = (
              0.25 * (x[:-1, :-1] + x[1:, :-1] + x[:-1, 1:] + x[1:, 1:])
          ).ravel()
          ymid = (
              0.25 * (y[:-1, :-1] + y[1:, :-1] + y[:-1, 1:] + y[1:, 1:])
          ).ravel()
          fig.multi_line(
              [
                  row
                  for row in np.stack(
                      (x[:-1, :-1].ravel(), xmid, x[1:, 1:].ravel()),
                      axis=1,
                  )
              ],
              [
                  row
                  for row in np.stack(
                      (y[:-1, :-1].ravel(), ymid, y[1:, 1:].ravel()),
                      axis=1,
                  )
              ],
              **kwargs,
          )
          fig.multi_line(
              [
                  row
                  for row in np.stack(
                      (x[:-1, 1:].ravel(), xmid, x[1:, :-1].ravel()),
                      axis=1,
                  )
              ],
              [
                  row
                  for row in np.stack(
                      (y[:-1, 1:].ravel(), ymid, y[1:, :-1].ravel()),
                      axis=1,
                  )
              ],
              **kwargs,
          )
      if point_color is not None:
          fig.circle(
              x=x.ravel(),
              y=y.ravel(),
              fill_color=color,
              line_color=None,
              alpha=alpha,
              size=8,
          )
  
imports: from __future__ import annotations
  import io
  from typing import TYPE_CHECKING, Any
  from bokeh.io import export_png, export_svg, show
  from bokeh.io.export import get_screenshot_as_png
  from bokeh.layouts import gridplot
  from bokeh.models.annotations.labels import Label
  from bokeh.palettes import Category10
  from bokeh.plotting import figure
  import numpy
  from contourpy import FillType, LineType
  from contourpy.enum_util import as_fill_type, as_line_type
  from contourpy.util.bokeh_util import filled_to_bokeh, lines_to_bokeh
  from contourpy.util.renderer import Renderer
label_desc: Use image node_id 5 for calling the BokehRenderer obj's underlying member method code with example usage: obj.grid(x, y, ax, color, alpha, point_color, quad_as_tri_alpha) without return types