draw#
Draws a diagram using networkx and matplotlib.
- param draw_as_nodes:
Whether to draw boxes as nodes, default is
False
.- type draw_as_nodes:
bool, optional
- param color:
Color of the box or node, default is white (
'#ffffff'
) for boxes and red ('#ff0000'
) for nodes.- type color:
string, optional
- param textpad:
Padding between text and wires, default is
(0.1, 0.1)
.- type textpad:
pair of floats, optional
- param draw_type_labels:
Whether to draw type labels, default is
False
.- type draw_type_labels:
bool, optional
- param draw_box_labels:
Whether to draw box labels, default is
True
.- type draw_box_labels:
bool, optional
- param aspect:
Aspect ratio, one of
['auto', 'equal']
.- type aspect:
string, optional
- param margins:
Margins, default is
(0.05, 0.05)
.- type margins:
tuple, optional
- param nodesize:
Node size for spiders and controlled gates.
- type nodesize:
float, optional
- param fontsize:
Font size for the boxes, default is
12
.- type fontsize:
int, optional
- param fontsize_types:
Font size for the types, default is
12
.- type fontsize_types:
int, optional
- param figsize:
Figure size.
- type figsize:
tuple, optional
- param path:
Where to save the image, if None we call
plt.show()
.- type path:
str, optional
- param to_tikz:
Whether to output tikz code instead of matplotlib.
- type to_tikz:
bool, optional
- param asymmetry:
Make a box and its dagger mirror images, default is
.25 * any(box.is_dagger for box in diagram.boxes)
.- type asymmetry:
float, optional