Backend#

class discopy.drawing.backend.Backend(linewidth=1)[source]#

Bases: ABC

Abstract drawing backend.

draw_text(text, i, j, **params)[source]#

Draws a piece of text at a given position.

draw_node(i, j, **params)[source]#

Draws a node for a given position, color and shape.

draw_polygon(*points, facecolor=None, edgecolor=None)[source]#

Draws a polygon given a list of points.

draw_wire(source, target, bend_out=False, bend_in=False, style=None)[source]#

Draws a wire from source to target, possibly with a Bezier.

draw_spiders(graph, draw_box_labels=True, **params)[source]#

Draws a list of boxes depicted as spiders.

abstract output(path=None, show=True, **params)[source]#

Output the drawing.

draw_box(positions, node, **params)[source]#

Draws a box node on a given backend.

draw_discard(positions, node, **params)[source]#

Draws a discopy.quantum.circuit.Discard box.

draw_measure(positions, node, **params)[source]#

Draws a discopy.quantum.circuit.Measure box.

draw_brakets(positions, node, **params)[source]#

Draws a discopy.quantum.gates.Ket box.

draw_controlled_gate(positions, node, **params)[source]#

Draws a discopy.quantum.gates.Controlled gate.