code: def figure(ax=None, scale=None, permutation=None):
      """
      Wraps a Matplotlib AxesSubplot or generates a new one. Emulates matplotlib's
      > figure, ax = plt.subplots()
  
      Parameters
      ----------
      ax: AxesSubplot, None
          The matplotlib AxesSubplot to wrap
      scale: float, None
          The scale factor of the ternary plot
      """
  
      ternary_ax = TernaryAxesSubplot(
          ax=ax, scale=scale, permutation=permutation
      )
      return ternary_ax.get_figure(), ternary_ax
  
imports: from collections import namedtuple
  from functools import partial
  import numpy
  from matplotlib import pyplot
  from .None import heatmapping
  from .None import lines
  from .None import plotting
  from .helpers import project_point, convert_coordinates_sequence
label_desc: Use image node_id 1 for calling a global function with example usage: figure(ax, scale, permutation) and returns: ternary_ax,  ternary_ax