sequince.plot#

Plotting utilities for sequince.

Functions#

plot_chains(chains[, n_chains, filename, ...])

Plot MCMC chains.

plot_corner(particles[, weights, parameter_inds, ...])

Plot a corner plot of the particles.

Module Contents#

sequince.plot.plot_chains(chains, n_chains=None, filename=None, parameter_labels=None, parameter_inds=None, split_indices=None, split_kwargs=None, **kwargs)[source]#

Plot MCMC chains.

Parameters:
  • chains (Array) – The MCMC chains to plot, of shape (n_steps, n_chains, n_params).

  • n_chains (int, optional) – The number of chains to plot. If None, all chains are plotted.

  • split_indices (sequence of int, optional) – Indices at which a new mutation-chain segment starts. A vertical line is drawn between the samples on either side of each split.

  • split_kwargs (dict, optional) – Keyword arguments for the vertical split lines.

  • filename (str | Path, optional) – If provided, the plot will be saved to this filename. If None, the plot will be returned as a matplotlib figure.

  • **kwargs (additional keyword arguments) – Additional keyword arguments to pass to the plot function.

  • parameter_labels (Sequence[str] | None)

  • parameter_inds (Sequence[int] | None)

sequince.plot.plot_corner(particles, weights=None, parameter_inds=None, parameter_labels=None, include_weights=True, filename=None, **kwargs)[source]#

Plot a corner plot of the particles.

Parameters:
  • particles (Array) – The particles to plot, of shape (n_particles, n_dimensions).

  • weights (Array, optional) – The weights of the particles, of shape (n_particles,). If None, uniform weights are assumed.

  • parameter_inds (Sequence[int], optional) – Indices of the parameters to plot. If None, all parameters are plotted.

  • parameter_labels (Sequence[str], optional) – Labels for the parameters. If None, default labels are used.

  • include_weights (bool, optional) – Whether to include weights in the corner plot. Default is True.

  • filename (str | Path, optional) – If provided, the plot will be saved to this filename. If None, the plot will be returned as a matplotlib figure.

  • **kwargs (additional keyword arguments) – Additional keyword arguments to pass to the corner plot function.

Returns:

fig – The corner plot figure, if filename is not provided.

Return type:

matplotlib.figure.Figure