serpentTools.utils.plot.placeLegend

serpentTools.utils.plot.placeLegend(ax, legend, handlesAndLabels=None, **kwargs)

Add a legend to the axes instance.

A legend will be drawn if at least one of the following criteria are met:

  1. legend is not one of the supported string legend control arguments that dictate where the legend should be placed

  2. More than one item has been plotted

Parameters
  • ax (matplotlib.axes.Axes, optional) –

  • on which to plot the data. If not provided, create a new (Ax) –

  • plot

  • legend (bool or str or None) –

  • label the plot. No legend will be made if a (Automatically) –

  • item is plotted. Pass one of the following values (single) –

  • place the legend outside the plot (to) –

  • handlesAndLabels (tuple (legend handles, labels), optional) – Exact legend handles (graphical element) and labels (string element) to be used in making the legend. If not provided, will be fetched from matplotlib.axes.Axes.get_legend_handles_labels()

  • kwargs (dict, optional) – Additional keyword arguments to be passed to matplotlib.axes.Axes.legend(), if applicable

Returns