infer_xy_dims

PlasmaCalcs.plotting.plot_tools.plot_dims.infer_xy_dims(dims, x=None, y=None, *, exclude=[], fail_ok=False)

infer x and y dims from dims, if not provided.

(if x and y are provided, just return x,y, after ensuring x,y in dims)
dims: iterable of strings
all possible dims. Probably array.dims, if trying to infer from an array.
x: None or str
the dimension which will index the plot’s x axis.
if None, infer it, if possible:
if y is known, first set dims = dims without y.
if len(dims)==1, use x=dims[0]
otherwise, use the first dim from DEFAULTS.PLOT.DIMS_INFER[‘x’] which appears in dims, if possible.
otherwise, try to infer y; might be able to infer x while inferring y.
y: None or str
the dimension which will index the plot’s y axis.
if None, infer it, if possible:
if x is known, first set dims = dims without x.
if len(dims)==1, use the only dim remaining from dims.
otherwise, use the first dim from DEFAULTS.PLOT.DIMS_INFER[‘y’] which appears in dims, if possible.
otherwise, if len(dims)==2 and x is None, use x, y = dims
exclude: iterable
dims to exclude from dims, before inferring x,y.
E.g. if dims=(‘x’, ‘y’, ‘z’, ‘t’) and exclude=(‘x’, ‘y’), then infer from dims=(‘z’, ‘t’).
Useful e.g. if it is already known which dims are used for x & y axes of the plot.
Exclude can contain any values, e.g. exclude=(‘x’, None) is fine.
fail_ok: bool
controls behavior when failing to infer dim:
True –> return None for that dim
False –> raise PlottingAmbiguityError