code: def heatmap(
      data,
      scale,
      vmin=None,
      vmax=None,
      cmap=None,
      ax=None,
      scientific=False,
      style="triangular",
      colorbar=True,
      permutation=None,
      use_rgba=False,
      cbarlabel=None,
      cb_kwargs=None,
  ):
      """
      Plots heatmap of given color values.
  
      Parameters
      ----------
      data: dictionary
          A dictionary mapping the i, j polygon to the heatmap color, where
          i + j + k = scale.
      scale: Integer
          The scale used to partition the simplex.
      vmin: float, None
          The minimum color value, used to normalize colors. Computed if absent.
      vmax: float, None
          The maximum color value, used to normalize colors. Computed if absent.
      cmap: String or matplotlib.colors.Colormap, None
          The name of the Matplotlib colormap to use.
      ax: Matplotlib AxesSubplot, None
          The subplot to draw on.
      scientific: Bool, False
          Whether to use scientific notation for colorbar numbers.
      style: String, "triangular"
          The style of the heatmap, "triangular", "dual-triangular" or "hexagonal"
      colorbar: bool, True
          Show colorbar.
      permutation: string, None
          A permutation of the coordinates
      use_rgba: bool, False
          Use rgba color values
      cbarlabel: string, None
          Text label for the colorbar
      cb_kwargs: dict
          dict of kwargs to pass to colorbar
  
      Returns
      -------
      ax: The matplotlib axis
      """
  
      if not ax:
          fig, ax = plt.subplots()
      # If use_rgba, make the RGBA values numpy arrays so that they can
      # be averaged.
      if use_rgba:
          for k, v in data.items():
              data[k] = np.array(v)
      else:
          cmap = get_cmap(cmap)
          if vmin is None:
              vmin = min(data.values())
          if vmax is None:
              vmax = max(data.values())
      style = style.lower()[0]
      if style not in ["t", "h", "d"]:
          raise ValueError(
              "Heatmap style must be 'triangular', 'dual-triangular', or 'hexagonal'"
          )
  
      vertices_values = polygon_generator(
          data, scale, style, permutation=permutation
      )
  
      # Draw the polygons and color them
      for vertices, value in vertices_values:
          if value is None:
              continue
          if not use_rgba:
              color = colormapper(value, vmin, vmax, cmap=cmap)
          else:
              color = value  # rgba tuple (r,g,b,a) all in [0,1]
          # Matplotlib wants a list of xs and a list of ys
          xs, ys = unzip(vertices)
          ax.fill(xs, ys, facecolor=color, edgecolor=color)
  
      if not cb_kwargs:
          cb_kwargs = dict()
      if colorbar:
          colorbar_hack(
              ax,
              vmin,
              vmax,
              cmap,
              scientific=scientific,
              cbarlabel=cbarlabel,
              **cb_kwargs,
          )
      return ax
  
file_path: python-ternary/ternary/heatmapping.py
imports: import functools
  import numpy
  from matplotlib import pyplot
  from .helpers import unzip, normalize, simplex_iterator, permute_point, project_point
  from .colormapping import get_cmap, colormapper, colorbar_hack
label_desc: Use image node_id 8 for calling a global function with example usage: heatmap(data, scale, vmin, vmax, cmap, ax, scientific, style, colorbar, permutation, use_rgba, cbarlabel, cb_kwargs) and returns: ax