calculate_lims_from_margin
- PlasmaCalcs.plotting.plot_tools.lims.calculate_lims_from_margin(min, max, margin=None, *, x=None, skipna=False, scale=None)
calculate the lims to use, based on min, max, and margin.
Return (min, max) after scaling them by this margin.min, max: None or numberNone –> return (None, None). (in this case, provided min and max must both be None.)number –> treat this as the before-applying-margin limits (in data-coordinates).margin: None or number (greater than -0.5, probably close to 0.05) (default: None)margin to use for x/y axis, as a fraction of the data interval for that axis.None –> use matplotlib defaults(e.g., plt.rcParams[“axes.xmargin”] or [“axes.ymargin”], or 0 if using imshow)positive number –> pad around the data region, with this much whitespace.E.g. 0.05 means adding 5% whitespace on each side.Use this to zoom out.negative number –> remove this much of the outer parts of the data region.E.g. -0.2 means removing 20% space from each side.Use this to zoom in.For line plots, if also usingrobust, ymargin will be applied to the robust y lims.(margin-related params share the same docstring, but refer to:‘xmargin’: x-axis, ‘ymargin’: y-axis, ‘margin’: x and/or y-axis.)x: None, ‘x’, or ‘y’must be provided ifmarginis not; tells which matplotlib default to use.ignored ifmarginis provided.skipna: boolwhether to return None instead of nan if min or max would be nan.scale: None, ‘linear’, or ‘log’whether margin is in linear or log space. If None, use ax’s current scale.(Actually, if None then default to ‘linear’ scale, in this function.)