shnitsel.vis.plot.time#

General timeplots – use on anything with a time coordinate

Functions#

_set_axes(data[, ax])

plot_single(data[, ax, time_coord])

Plot some property of a single trajectory over time

plot_ci(data[, ax, time_coord])

Plot some property of trajectories over time, aggregated as means and confidence intervals

plot_many(data[, ax, time_coord])

Plot some property of trajectories over time as thin lines;

plot_shaded(data, ax[, time_coord])

Plot some property of trajectories over time, aggregated by using colour

timeplot(data[, ax, trajs, sep, time_coord])

Plot some property of one or many trajectories over time,

Module Contents#

_set_axes(data, ax=None)#
plot_single(data, ax=None, time_coord='time')#

Plot some property of a single trajectory over time

Parameters:
  • data – Data to plot

  • ax – A matplotlib Axes onto which to plot; if not provided, one will be created.

Return type:

The Axes object used

Raises:

ValueError – If data has both ‘state’ and ‘statecomb’ dimensions.

plot_ci(data, ax=None, time_coord='time')#

Plot some property of trajectories over time, aggregated as means and confidence intervals

Parameters:
  • data – Data to plot

  • ax – A matplotlib Axes onto which to plot; if not provided, one will be created.

Return type:

The Axes object used

Raises:

ValueError – If data has both ‘state’ and ‘statecomb’ dimensions.

plot_many(data, ax=None, time_coord='time')#

Plot some property of trajectories over time as thin lines; state or statecomb is indicated by colour

Parameters:
  • data – Data to plot

  • ax – A matplotlib Axes onto which to plot; if not provided, one will be created.

Return type:

The Axes object used

Raises:

ValueError – If data has both ‘state’ and ‘statecomb’ dimensions.

plot_shaded(data, ax, time_coord='time')#

Plot some property of trajectories over time, aggregated by using colour to show how many overlap at a given point

Parameters:
  • data – Data to plot

  • ax – A matplotlib Axes onto which to plot; if not provided, one will be created.

Return type:

The Axes object used.

Raises:

ImportError – If the datashader library is not installed.

timeplot(data, ax=None, trajs=None, sep=False, time_coord='time')#

Plot some property of one or many trajectories over time, possibly aggregating over trajectories, and distinguishing different states/statecombs if applicable.

Parameters:
  • data (xarray.DataArray) – Data to plot

  • ax (matplotlib.pyplot.Axes | None) – A matplotlib Axes onto which to plot; if not provided, one will be created.

  • trajs (Literal['ci', 'shade', 'conv', None]) –

    How to aggregate trajectories, if at all:
    • None (default): do not aggregate

    • ’ci’: aggregate by confidence interval

    • ’shade’: use colour to represent overlap

      density using the datashader library (to produce what is sometimes called a hairplot)

  • sep (bool) – Whether to plot different states/statecombs separately; this will be done regardless when using trajs='shade'.

Return type:

The Axes object used

Raises:
  • ValueError

    • If data has both ‘state’ and ‘statecomb’ dimensions.

    • If ax is passed when multiple Axes will be required

      as states/statecombs are to be plotted separately.

    • If trajs is set to a value other than None, ‘ci’ or ‘shade’

  • NotImplementedError – If trajs='conv' is used