PlasmaCalcs.addons.instability_tools.instability_theory_tools.xarray_klines
- PlasmaCalcs.addons.instability_tools.instability_theory_tools.xarray_klines(ds, *, log=None, mfp={'color': 'blue', 'lw': 2}, debye={'color': 'red', 'lw': 2}, fluids=None, fluid_styles=UNSET, direction='h', label='({val:.3g}) {log}{shortvar} ({fluid})', add_legend=True, legend_kw=UNSET, **kw_line)
- draw lines representing mean free path, and debye length, on a plot with a |k| axis.
- ds: Dataset
- dataset containing klims_physical values. (see: xarray_klims_physical)(at least one of: ‘ldebye’, ‘lmfp’, ‘eqperp_ldebye’, ‘eqperp_lmfp’,‘kdebye’, ‘kmfp’, ‘eqperp_kdebye’, ‘eqperp_kmfp’.)
- log: None or bool
- whether to plot log10 of values, instead of just the values themselves.None –> True if plt.gca() axis label has ‘log_’ in it, else False.(ylabel if direction says axhline; else xlabel.)
- mfp: dict or False
- style to apply to mean free path lines.False –> don’t plot mean free path lines.
- debye: dict or False
- style to apply to debye length lines.False –> don’t plot debye length lines.
- fluids: None, ‘min’, ‘max’, or (‘min’, ‘max’)
- None –> plot lines for each fluid.‘min’ –> plot line for only 1 fluid, whichever makes line at smallest |k|‘max’ –> plot line for only 1 fluid, whichever makes line at largest |k|(‘min’, ‘max’) –> plot ‘min’ and ‘max’ lines.note: to plot an arbitrary subset of fluids, just use ds.isel(fluid=…) beforehand.
- fluid_styles: UNSET or dict of lists
- styles to ensure fluid lines appear visually distinct.E.g. {‘ls’: [‘-’, ‘–’, ‘:’]} –> use ls=’-’ for first fluid, ‘–’ for next, etc.UNSET –> use DEFAULTS.PLOT.TIMELINES_CYCLE1; default is a dict of different linestyles.
- direction: ‘h’, ‘v’, ‘horizontal’, or ‘vertical’
- direction to plot lines.‘h’ or ‘horizontal’ –> plt.axhline‘v’ or ‘vertical’ –> plt.axvline
- label: str
- label for each line. will be hit by .format(…) with the following kwargs:‘log’: ‘log10 ‘ if log else ‘’.‘var’: variable name. ‘kdebye’, ‘kmfp’, ‘eqperp_kdebye’, or ‘eqperp_kmfp’.‘kvar’: alias to ‘var’‘lvar’: length variable name. E.g. ‘ldbeye’ instead of ‘kdebye’.‘pubvar’: variable suitable for publication. ‘k Debye’ or ‘k mean free path’‘shortvar’: shorthand variable name. ‘debye’ or ‘mfp’‘fluid’: fluid name‘val’: value at which the line is plotted
- add_legend: bool
- whether to plt.legend()
- legend_kw: UNSET or dict
- kwargs to pass to plt.legend().UNSET –> use DEFAULTS.ADDONS.GROWTHPLOT_LEGEND_KW
additional kwargs go to plt.axhline or plt.axvline.