oineus.plot_chain¶
- oineus.plot_chain(source, filtration, chain, *, ax=None, source_kind=None, dualize=False, chain_color=None, point_cloud_color=None, edge_style=None, triangle_style=None, tetrahedron_style=None, vertex_style=None, point_style=None, title=None, plot_source=True, field_cmap='viridis')[source]¶
Render a chain of cells over its underlying source.
sourceis one of:a 2D point cloud as
(N, 2)ndarray (simplicial filtration),a 3D point cloud as
(N, 3)ndarray (simplicial filtration),a 2D scalar field as
(H, W)ndarray (cubical or Freudenthal),a 3D scalar field as
(D, H, W)ndarray (cubical or Freudenthal).
The dispatch is driven by
source_kind("points"or"field") and, for kind"points", bysource.shape[1](2 vs 3). Whensource_kindisNonewe routeCubeFiltration_*Dto"field"and everything else to"points".The chain may be a list, ndarray, range, or scipy.sparse column / row slice (e.g.
dcmp.v_as_csc()[:, j]). Each entry is normally a filtration sorted-id; cells of dim 0/1/2/3 render as vertices / edges / triangles-or-squares / tetrahedra-or-voxels respectively.The matrices
v_data,r_data,u_data_tof aDecomposition(fil, dualize=True)are indexed in cohomology matrix space rather than filtration space (matrix index =n - 1 - filtration_id). Passdualize=True(ordualize=dcmpand we will readdcmp.dualizefor you) so plot_chain translates the chain back to filtration ids before looking up cells. The defaultFalsematches homology decompositions and indices that have already been translated (e.g. those returned byTopologyOptimizer.increase_birth).- Colors:
chain_color– single color ordict[int, color](keys arecell dimensions: 0=vertex, 1=edge, 2=triangle, 3=tetrahedron); applied to whatever the matching style dict didn’t already override.
None(default) usesDEFAULT_CHAIN_COLORuniformly.point_cloud_color– single color for the underlyingpoint-cloud / field background.
None(default) usesDEFAULT_POINT_CLOUD_COLOR.