Drawing simplicial complexes

Drawing a simplicial complex involves imposing a geometry onto the topological structure. This is typically very difficult for high-dimensional complexes – and can be tricky even for two-dimensional complexes with lots of strange connections.

Important

At present the drawing routines are very basic.

The drawing routines in simplicial are based around the use of the simplicial.Embedding class, which specifies the embedding of a simplicial complex into a space. Various sub-classes of simplicial.Embedding provide different positionings, which the drawing sub-system then renders. Note that there is no decent default or automatic layout generation yet.

Drawing a complex

simplicial.drawing.draw_complex(c, em, ax=None, color=None, color_simplex=None, node_size=0.02)

Draw a simplicial complex embedded in space.

The colours of the simplices are taken either from the color array or from the color_simplex function: the latter overrrides the former if both are provided.

At present we only deal with simplices of order 2 and less.

Parameters
  • c (SimplicialComplex) – the complex

  • em (Embedding) – embedding providing the positions of the 0-simplices

  • ax (Optional[Axes]) – the axes to draw in (defaults to main axes)

  • color (Optional[Iterable[Union[str, Tuple[float, float, float], Tuple[float, float, float, float]]]]) – an array of colours for the different simplex orders (defaults to a “reasonable” scheme)

  • color_simplex (Optional[Callable[[SimplicialComplex, Any, int], Union[str, Tuple[float, float, float], Tuple[float, float, float, float]]]]) – a function from complex, simplex and order to a colour (defaults to order color)

  • node_size (float) – the size of the node (0-simplex) markers