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.Filtration,
points: numpy.ndarray[tuple[Literal[2], int], numpy.dtype[numpy.floating]],
filtration_times: collections.abc.Sequence[float],
animation_length: float,
plot_colours: str | numpy.ndarray | None = None,
) 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 filtration times.

  • plot_colours – Either the name of a matplotlib qualitative colour map, or a list of colours. If not provided, the current matplotlib colour cycle will be used.

draw_filtration(
K: chalc.filtration.Filtration,
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,
plot_colours: str | numpy.ndarray | 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_colours – Either the name of a matplotlib qualitative colour map, or a list of colours. If not provided, the current matplotlib colour cycle will be used.

plot_diagram(
dgms: chalc.sixpack.SixPack,
diagram_name: chalc.sixpack.SixPack.DiagramName,
truncation: float | None = None,
dimensions: collections.abc.Collection[int] | int | None = None,
ax: matplotlib.axes.Axes | None = None,
threshold: 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.

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

plot_sixpack(
dgms: chalc.sixpack.SixPack,
truncations: collections.abc.Mapping[chalc.sixpack.SixPack.DiagramName, float] | float | None = None,
dimensions: collections.abc.Collection[int] | int | None = None,
threshold: float = 0,
) tuple[matplotlib.figure.Figure, numpy.ndarray[tuple[Literal[2], Literal[3]], numpy.dtype[Any]]]

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.

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