code: def heatmapf(
      func,
      scale=10,
      boundary=True,
      cmap=None,
      ax=None,
      scientific=False,
      style="triangular",
      colorbar=True,
      permutation=None,
      vmin=None,
      vmax=None,
      cbarlabel=None,
      cb_kwargs=None,
  ):
      """
      Computes func on heatmap partition coordinates and plots heatmap. In other
      words, computes the function on lattice points of the simplex (normalized
      points) and creates a heatmap from the values.
  
      Parameters
      ----------
      func: Function
          A function of 3-tuples to be heatmapped
      scale: Integer
          The scale used to partition the simplex
      boundary: Bool, True
          Include the boundary points or not
      cmap: String, None
          The name of the Matplotlib colormap to use
      ax: Matplotlib axis object, None
          The axis to draw the colormap on
      style: String, "triangular"
          The style of the heatmap, "triangular", "dual-triangular" or "hexagonal"
      scientific: Bool, False
          Whether to use scientific notation for colorbar numbers.
      colorbar: bool, True
          Show colorbar.
      permutation: string, None
          A permutation of the coordinates
      vmin: float
          The minimum color value, used to normalize colors.
      vmax: float
          The maximum color value, used to normalize colors.
      cb_kwargs: dict
          dict of kwargs to pass to colorbar
  
      Returns
      -------
      ax, The matplotlib axis
      """
  
      # Apply the function to a simplex partition
      data = dict()
      for i, j, k in simplex_iterator(scale=scale, boundary=boundary):
          data[(i, j)] = func(normalize([i, j, k]))
      # Pass everything to the heatmapper
      ax = heatmap(
          data,
          scale,
          cmap=cmap,
          ax=ax,
          style=style,
          scientific=scientific,
          colorbar=colorbar,
          permutation=permutation,
          vmin=vmin,
          vmax=vmax,
          cbarlabel=cbarlabel,
          cb_kwargs=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 9 for calling a global function with example usage: heatmapf(func, scale, boundary, cmap, ax, scientific, style, colorbar, permutation, vmin, vmax, cbarlabel, cb_kwargs) and returns: ax