Visualizing braids
The following code presents the different visualizations integrated in
braidpy. They need its viz extra: pip install "braidpy[viz]".
from braidpy import Braid
from braidpy.parametric_braid import ParametricBraid
b = Braid((1, -2), n_strands=3)
# Draw in console
b.draw()
# 2D braid diagram
b.plot()
# 3D braid plot
strands = (b**12).to_parametric_strands()
p = ParametricBraid(strands)
p.plot()
Draw colored braid diagram in terminal
The first basic visualization enables to draw a braid diagram directly in the console, with some colors !

The direction of the arrow indicates the braid of the corresponding color is moving above its neighbour.
Plot colored braid diagram
The second type of visualization enables to plot a 2D braid diagram using matplotlib:
b.plot()

The braid runs down the page, the way it hangs and the way a braider works it, with
its word written above. Strands are coloured the way b.draw() colours them in the
console, so a strand is the same colour wherever you look at it, and the strand
passing behind is interrupted where the two meet.
gap sets how wide that break is as a fraction of the strand spacing, amplitude
how far a strand swings out as it crosses, and profile=LINEAR draws straight
segments instead of curves.
Plot 3D braid
The third level is 3D visualization. You first need to convert your braidword to a parametric braid. Then you can plot the parametric braid using either matplotlib or plotly:
Using plotly:

Using matplotlib:
