Visualizing braids๏ƒ

The followign code presents the different visualizations integrated in braidpy:

from braidpy import Braid
from braidpy.parametric_braid import ParametricBraid
from braidpy.parametric_strand import braid_to_parametric_strands
import matplotlib

matplotlib.use("QtAgg")
b = Braid((1, -2), n_strands=3)
b.draw()
b.plot()
strands = braid_to_parametric_strands(b ** 12)
p = ParametricBraid(strands)  # .plot()
p.plot()

Draw colored braid diagram in terminal๏ƒ

The tirst basic visualization enables to draw a braid diagram directly in the console, with some colors !

colored ASCII braid example

The direction of the arrow indicates the braid of the corresponding color is moving above its neighboor.

Plot colored braid diagram๏ƒ

The second type of visualization enables to plot a 2D braid diagram using matplotlib:

b.plot()

2D braid diagram

Warning: for now this plot is using braidvisualizer and is not following the same color code.

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:

3D braid example plotly

Using matplotlib: 3D braid example