oineus.plot_diagram¶
- oineus.plot_diagram(diagrams, ax=None, *, color=None, cmap=None, log_x=False, log_y=False, title=None, suptitle=None, axis_bounds=None, dims=None, max_dimension=None, scatter_only=True, density_threshold=20000, near_diagonal_fraction=0.03, density_style=None, inf_line_margin=0.05, point_style=None, inf_point_style=None, diagonal_style=None, inf_line_style=None, grid_style=None, dim_label_fmt='H{dim}', use_density=<object object>)[source]¶
Plot one or more persistence diagrams.
Default rendering is pure scatter: every finite point gets its own marker, so the visual density of overlapping markers faithfully tracks the actual point density. Pass
scatter_only=Falseto opt into the hybrid density-bulk + outlier-scatter mode (suitable for very large diagrams where the near-diagonal noise band saturates the scatter). In that hybrid mode the bulk near the diagonal is rendered as a 2D density (via mpl_scatter_density) while points further thannear_diagonal_fractionof the axis range from the diagonal are still drawn as crisp scatter, so high-persistence (topologically meaningful) features are never aggregated.Color of the diagram points is taken from the top-level
colorargument: pass a single color ("red","#012345",(r, g, b[, a])) to override every dim, adictmapping dim -> color, or alistcycled through dims in sort order.None(default) leaves the choice to matplotlib’s per-call cycle. Passing a single color when the input has more than one dim emits aUserWarning.When
coloris set and density mode is active, the density artist uses a single-hue fade-to-transparent ramp keyed offcolorrather than the cmap-based default; this is what makes 2-diagram overlays of the formplot_diagram(dgm_a, color="C0"); plot_diagram(dgm_b, color="C1")on the same axes read as two distinct distributions.cmapis forwarded to the density-aggregation path whencoloris None; passNoneto keep the default (viridis).Style-dict kwargs (
point_style,inf_point_style,diagonal_style,inf_line_style,density_style) default to copies of the module-levelDEFAULT_*_STYLEdicts and no longer carry acolor/ckey.inf_point_stylecontrols the markers placed on the horizontal inf-line (death = +-inf); the default uses an upward triangle so essentials read distinctly from finite points.The
use_densitykwarg is deprecated; passscatter_onlyinstead.use_density=Falsecorresponds toscatter_only=Trueand vice versa.- Parameters:
log_x (bool)
log_y (bool)
title (str | None)
suptitle (str | None)
max_dimension (int | None)
scatter_only (bool)
density_threshold (int)
near_diagonal_fraction (float)
density_style (dict | None)
inf_line_margin (float)
point_style (dict | None)
inf_point_style (dict | None)
diagonal_style (dict | None)
inf_line_style (dict | None)
dim_label_fmt (str)