code: def histogram2d(
      x: NumericExpression,
      y: NumericExpression,
      bins: int = 40,
      range: Optional[Tuple[int, int]] = None,
      title: Optional[str] = None,
      width: int = 600,
      height: int = 600,
      colors: Sequence[str] = bokeh.palettes.all_palettes["Blues"][7][
          ::-1
      ],
      log: bool = False,
  ) -> figure:
      """Plot a two-dimensional histogram.
  
      ``x`` and ``y`` must both be a :class:`.NumericExpression` from the same :class:`.Table`.
  
      If ``x_range`` or ``y_range`` are not provided, the function will do a pass through the data to determine
      min and max of each variable.
  
      Examples
      --------
  
      >>> ht = hail.utils.range_table(1000).annotate(x=hail.rand_norm(), y=hail.rand_norm())
      >>> p_hist = hail.plot.histogram2d(ht.x, ht.y)
  
      >>> ht = hail.utils.range_table(1000).annotate(x=hail.rand_norm(), y=hail.rand_norm())
      >>> p_hist = hail.plot.histogram2d(ht.x, ht.y, bins=10, range=((0, 1), None))
  
      Parameters
      ----------
      x : :class:`.NumericExpression`
          Expression for x-axis (from a Hail table).
      y : :class:`.NumericExpression`
          Expression for y-axis (from the same Hail table as ``x``).
      bins : int or [int, int]
          The bin specification:
          -   If int, the number of bins for the two dimensions (nx = ny = bins).
          -   If [int, int], the number of bins in each dimension (nx, ny = bins).
          The default value is 40.
      range : None or ((float, float), (float, float))
          The leftmost and rightmost edges of the bins along each dimension:
          ((xmin, xmax), (ymin, ymax)). All values outside of this range will be considered outliers
          and not tallied in the histogram. If this value is None, or either of the inner lists is None,
          the range will be computed from the data.
      width : int
          Plot width (default 600px).
      height : int
          Plot height (default 600px).
      title : str
          Title of the plot.
      colors : Sequence[str]
          List of colors (hex codes, or strings as described
          `here <https://bokeh.pydata.org/en/latest/docs/reference/colors.html>`__). Compatible with one of the many
          built-in palettes available `here <https://bokeh.pydata.org/en/latest/docs/reference/palettes.html>`__.
      log : bool
          Plot the log10 of the bin counts.
  
      Returns
      -------
      :class:`bokeh.plotting.figure`
      """
      data = _generate_hist2d_data(x, y, bins, range).to_pandas()
  
      # Use python prettier float -> str function
      data["x"] = data["x"].apply(lambda e: str(float(e)))
      data["y"] = data["y"].apply(lambda e: str(float(e)))
  
      mapper: ColorMapper
      if log:
          mapper = LogColorMapper(
              palette=colors, low=data.c.min(), high=data.c.max()
          )
      else:
          mapper = LinearColorMapper(
              palette=colors, low=data.c.min(), high=data.c.max()
          )
  
      x_axis = sorted(set(data.x), key=lambda z: float(z))
      y_axis = sorted(set(data.y), key=lambda z: float(z))
      p = figure(
          title=title,
          x_range=x_axis,
          y_range=y_axis,
          x_axis_location="above",
          width=width,
          height=height,
          tools="hover,save,pan,box_zoom,reset,wheel_zoom",
          toolbar_location="below",
      )
  
      p.grid.grid_line_color = None
      p.axis.axis_line_color = None
      p.axis.major_tick_line_color = None
      p.axis.major_label_standoff = 0
      import math
  
      p.xaxis.major_label_orientation = math.pi / 3
  
      p.rect(
          x="x",
          y="y",
          width=1,
          height=1,
          source=data,
          fill_color={"field": "c", "transform": mapper},
          line_color=None,
      )
  
      color_bar = ColorBar(
          color_mapper=mapper,
          ticker=LogTicker(desired_num_ticks=len(colors))
          if log
          else BasicTicker(desired_num_ticks=len(colors)),
          label_standoff=12 if log else 6,
          border_line_color=None,
          location=(0, 0),
      )
      p.add_layout(color_bar, "right")
  
      hovertool = p.select_one(HoverTool)
      assert hovertool is not None
      hovertool.tooltips = [
          ("x", "@x"),
          (
              "y",
              "@y",
          ),
          ("count", "@c"),
      ]
  
      return p
  
imports: import math
  import collections
  import numpy
  import pandas
  import bokeh
  import bokeh.io
  import bokeh.models
  import warnings
  from bokeh.models import HoverTool, ColorBar, LogTicker, LogColorMapper, LinearColorMapper, CategoricalColorMapper, ColumnDataSource, BasicTicker, Plot, CDSView, GroupFilter, IntersectionFilter, Legend, LegendItem, Renderer, CustomJS, Select, Column, Span, DataRange1d, Slope, Label, ColorMapper, GridPlot
  import bokeh.plotting
  import bokeh.palettes
  from bokeh.plotting import figure
  from bokeh.transform import transform
  from bokeh.layouts import gridplot
  from hail.expr import aggregators
  from hail.expr.expressions import Expression, NumericExpression, StringExpression, LocusExpression, Int32Expression, Int64Expression, Float32Expression, Float64Expression, expr_numeric, expr_float64, expr_any, expr_locus, expr_str, raise_unless_row_indexed
  from hail.expr.functions import _error_from_cdf_python
  from hail.typecheck import typecheck, oneof, nullable, sized_tupleof, numeric, sequenceof, dictof
  from hail import Table, MatrixTable
  from hail.utils.struct import Struct
  from hail.utils.java import warning
  from typing import List, Tuple, Dict, Union, Callable, Optional, Sequence, Any, Set
  import hail
label_desc: Use image node_id 10 for calling a global function with example usage: histogram2d(x, y, bins, range, title, width, height, colors, log) and returns: p