chalc.plotting

Plotting and visualisation utilities.

Functions

animate_filtration(→ matplotlib.animation.FuncAnimation)

Create animation of 2-skeleton of filtered simplicial complex.

draw_filtration(→ matplotlib.axes.Axes)

Visualise a 2D filtration at given time, optionally including only certain colours.

plot_diagram(→ matplotlib.axes.Axes | None)

Plot a specific diagram from a 6-pack.

plot_sixpack(→ tuple[matplotlib.figure.Figure, ...)

Plot the 6-pack of persistence diagrams returned by compute.

Module Contents

animate_filtration(
K: chalc.filtration.FilteredComplex,
points: numpy.ndarray[tuple[Literal[2], int], numpy.dtype[numpy.floating]],
filtration_times: collections.abc.Sequence[float],
animation_length: float,
) matplotlib.animation.FuncAnimation

Create animation of 2-skeleton of filtered simplicial complex.

Parameters:
  • K – A filtered complex.

  • points – The vertices of K as a \(2\times N\) numpy matrix.

  • filtration_times – Sequence of filtration times for which to draw animation frames.

  • animation_length – Total length of the animation in seconds, unrelated to the

  • times. (filtration)

draw_filtration(
K: chalc.filtration.FilteredComplex,
points: numpy.ndarray[tuple[Literal[2], int], numpy.dtype[numpy.floating]],
time: float,
include_colours: collections.abc.Collection[int] | None = None,
ax: matplotlib.axes.Axes | None = None,
) matplotlib.axes.Axes

Visualise a 2D filtration at given time, optionally including only certain colours.

Parameters:
  • K – A filtered 2-dimensional simplicial complex.

  • points – The vertices of K as a \(2\times N\) numpy matrix.

  • time – Filtration times for which to draw simplices.

  • include_colours – Optional collection of colours to include. If not specified then all colours will be drawn.

  • ax – A matplotlib axes object. If provided then the diagram will be plotted on the given axes.

plot_diagram(
dgms: chalc.sixpack.DiagramEnsemble,
diagram_name: chalc.sixpack.DiagramEnsemble.DiagramName,
truncation: float | None = None,
dimensions: collections.abc.Set[int] | int | None = None,
ax: matplotlib.axes.Axes | None = None,
tolerance: float = 0,
) matplotlib.axes.Axes | None

Plot a specific diagram from a 6-pack.

Parameters:
  • dgms – The 6-pack of persistence diagrams.

  • diagram_name – One of 'ker', 'cok', 'dom', 'cod', 'im', or 'rel'.

  • truncation – The maximum entrance time for which the diagrams are plotted. A sensible default will be calculated if not provided.

  • dimensions – The homological dimensions for which to plot features. If not provided, all dimensions will be included in the plots.

  • ax – A matplotlib axes object. If provided then the diagram will be plotted on the given axes.

  • tolerance – Only features with persistence greater than this value will be plotted.

plot_sixpack(
dgms: chalc.sixpack.DiagramEnsemble,
truncations: collections.abc.Mapping[chalc.sixpack.DiagramEnsemble.DiagramName, float] | float | None = None,
dimensions: collections.abc.Set[int] | int | None = None,
tolerance: float = 0,
) tuple[matplotlib.figure.Figure, numpy.ndarray[tuple[Literal[2], Literal[3]], numpy.dtype[matplotlib.axes.Axes]]]

Plot the 6-pack of persistence diagrams returned by compute.

Parameters:
  • dgms – The 6-pack of persistence diagrams.

  • truncations – The maximum entrance time upto which features are plotted. Can be either a single value, or a mapping from diagram names to values. A sensible default will be calculated (for each individual diagram) if not provided.

  • dimensions – The homological dimensions for which to plot features. If not provided, all dimensions will be included in the plots.

  • tolerance – Only features with persistence greater than this value will be plotted.