serpentTools.utils.plot.formatPlot¶
-
serpentTools.utils.plot.
formatPlot
(ax, xlabel=None, ylabel=None, logx=False, logy=False, loglog=False, title=None, legend=True, legendcols=1, axkwargs=None, legendkwargs=None)¶ Apply a range of formatting options to the plot.
- Parameters
ax (
matplotlib.axes.Axes
, optional) – Ax on which to plot the data. If not provided, create a new plotxlabel (str or bool, optional) – Label to apply to the x-axis. If given as
None
, a label will be determined from other arguments. If notNone
but evaluates toFalse
, do not label.ylabel (str or bool, optional) – Label to apply to the y-axis. If given as
None
, a label will be determined from other arguments. If notNone
but evaluates toFalse
, do not label.loglog (bool) – Apply a log scale to both axes.
logx (bool) – Apply a log scale to x axis.
logy (bool) – Apply a log scale to y axis.
title (str, optional) – Title to apply to this axes object
legend (bool or str or None) – Automatically label the plot. No legend will be made if a single item is plotted. Pass one of the following values to place the legend outside the plot: above, right
legendcols (int, optional) – Number of columns to apply to the legend, if applicable
axkwargs (dict, optional) – Additional keyword arguments to be passed to
matplotlib.axes.Axes.set()
. Values likexlabel
,ylabel
,xscale
,yscale
, and title will be respected, even though they are also arguments to this functionlegendkwargs (dict, optional) – Additional keyword arguments to be passed to
matplotlib.axes.Axes.legend()
. Values liketitle
andncol
will be respected.
- Returns
Ax on which the data was plotted.
- Return type
- Raises
TypeError – If the
ax
argument is not an instance ofmatplotlib.pyplot.axes.Axes