class_docstr: HeatMap represents a 2D grid of categorical coordinates which can
  be computed from a sparse tabular representation. A HeatMap does
  not automatically aggregate the supplied values, so if the data
  contains multiple entries for the same coordinate on the 2D grid
  it should be aggregated using the aggregate method before display.
  
  The HeatMap constructor will support any tabular or gridded data
  format with 2 coordinates and at least one value dimension. A
  simple example:
  
      HeatMap([(x1, y1, z1), (x2, y2, z2), ...])
  
  However any tabular and gridded format, including pandas
  DataFrames, dictionaries of columns, xarray DataArrays and more
  are supported if the library is importable.
class_docstr_tok: ["HeatMap","represents","a","2D","grid","of","categorical","coordinates","which","can","be","computed","from","a","sparse","tabular","representation",".","A","HeatMap","does","not","automatically","aggregate","the","supplied","values",",","so","if","the","data","contains","multiple","entries","for","the","same","coordinate","on","the","2D","grid","it","should","be","aggregated","using","the","aggregate","method","before","display",".","The","HeatMap","constructor","will","support","any","tabular","or","gridded","data","format","with","2","coordinates","and","at","least","one","value","dimension",".","A","simple","example",":","HeatMap","(","[","(","x1",",","y1",",","z1",")",",","(","x2",",","y2",",","z2",")",",","...","]",")","However","any","tabular","and","gridded","format",",","including","pandas","DataFrames",",","dictionaries","of","columns",",","xarray","DataArrays","and","more","are","supported","if","the","library","is","importable","."]
docstr: Return the lower and upper bounds of values along dimension.
  
  Args:
      dimension: The dimension to compute the range on.
      data_range (bool): Compute range from data values
      dimension_range (bool): Include Dimension ranges
          Whether to include Dimension range and soft_range
          in range calculation
  
  Returns:
      Tuple containing the lower and upper bound
docstr_tok: ["Return","the","lower","and","upper","bounds","of","values","along","dimension",".","Args",":","dimension",":","The","dimension","to","compute","the","range","on",".","data_range","(","bool",")",":","Compute","range","from","data","values","dimension_range","(","bool",")",":","Include","Dimension","ranges","Whether","to","include","Dimension","range","and","soft_range","in","range","calculation","Returns",":","Tuple","containing","the","lower","and","upper","bound"]
code: def range(self, dim, data_range=True, dimension_range=True):
      """Return the lower and upper bounds of values along dimension.
  
      Args:
          dimension: The dimension to compute the range on.
          data_range (bool): Compute range from data values
          dimension_range (bool): Include Dimension ranges
              Whether to include Dimension range and soft_range
              in range calculation
  
      Returns:
          Tuple containing the lower and upper bound
      """
      dim = self.get_dimension(dim)
      if dim in self.kdims:
          try:
              self.gridded._binned = True
              if self.gridded is self:
                  return super().range(dim, data_range, dimension_range)
              else:
                  drange = self.gridded.range(
                      dim, data_range, dimension_range
                  )
          except Exception:
              drange = None
          finally:
              self.gridded._binned = False
          if drange is not None:
              return drange
      return super().range(dim, data_range, dimension_range)
  
imports: import colorsys
  from copy import deepcopy
  from operator import itemgetter
  import numpy
  import param
  from ..core import Dataset, Dimension, Element2D, Overlay, config, util
  from ..core.boundingregion import BoundingBox, BoundingRegion
  from ..core.data import ImageInterface
  from ..core.data.interface import DataError
  from ..core.dimension import dimension_name
  from ..core.sheetcoords import SheetCoordinateSystem, Slice
  from .chart import Curve
  from .geom import Selection2DExpr
  from .graphs import TriMesh
  from .tabular import Table
  from .util import categorical_aggregate2d, compute_slice_bounds
label_desc: Use image node_id 4 for calling the HeatMap obj's underlying member method code with example usage: obj.range(dim, data_range, dimension_range) and returns: super, drange, super