Module vorts.plot
Plotting routines
Functions
def plot_poincare(ds, *, iv_ref=0, c='0.35', ms=0.2, alpha=0.5, cycle_comp='add', cycle_by='vorton', title='Poincaré section (tracers)', frame='none', plot_vortons=False, vorton_colors=None, ax=None, **kwargs)
-
Plot Poincaré section.
Parameters
ds
:xarray.Dataset
- Model output or output from
select_poincare_times()
. iv_ref
:int
- Index of the vorton to use for reference (passed to
select_poincare_times()
). c
:str
orarray_like
- Marker color (any of these formats). OR iterable of individual colors, which will be cycled.
ms
:float
- Marker size. OR iterable of individual sizes, which will be cycled.
alpha
:float
- Marker alpha. OR iterable of individual alpha values, which will be cycled.
cycle_comp
:str, {'add', 'multiply'}
- How to compose the property cyclers—add or multiply.
cycle_by
:str, {'vorton', 'time'}
- Whether certain times will have certain properties, or certain vortons will.
title
:str
- Plot title.
frame
:str, {'none', 'only', 'default'}
- No frame (using
remove_frame()
), frame only (usingremove_ticks()
), or default style (do nothing). plot_vortons
:bool
- Whether to plot the initial vorton positions on top.
vorton_colors
- Colors, of valid format (like
c
). OR single color. By default, cycles through New Tableau 10. ax
:matplotlib.axes.Axes
, optional- Optionally pass
ax
on which to plot. Otherwise a new figure will be created. **kwargs
- Passed on to
select_poincare_times()
(if applicable) orplt.subplots()
orax.plot()
See Also
def plot_tracer_trajectories(ds, title='Tracers', ax=None, **kwargs)
-
Plot tracer trajectories.
Parameters
ds
:xarray.Dataset
hist
attribute of the model instance.title
:str
- Plot title.
**kwargs
- Passed on to
plt.subplots()
def plot_vorton_trajectories(ds, title='Vortons', ax=None, **kwargs)
-
Plot lines: one for each vorton's trajectory.
Parameters
ds
:xarray.Dataset
hist
attribute of the model instance.title
:str
- Plot title.
**kwargs
- Passed on to
plt.subplots()
def remove_frame(ax=None, *, keep_title=True)
-
Remove ticks, tick labels, and frame (spines) from
ax
(uses current by default). def remove_ticks(ax=None, *, keep_ax_labels=True, keep_title=True)
-
Remove ticks and tick labels from
ax
(uses current by default). def select_poincare_times(ds, iv_ref=0, *, xtol=0.01, ytol=0.01)
-
From a model output dataset, extract data corresponding to times to use for the Poincaré section.
We find the times when the reference vorton (with index
iv_ref
) is in its original position.Parameters
ds
:xarray.Dataset
- For example, the
hist
attribute of the model instance. iv_ref
:int
- Index of the vorton to use for reference.
xtol
,ytol
:float
- Tolerance in each direction to use when searching for timesteps when the reference vorton is in its original position.
Returns
xarray.Dataset
- A selection (
.sel
) of the originalds
consisting only of the timesteps when the reference vorton is approximately in the desired position.