Formatting and drawing
This document explains how to format and draw a compiled circuit in Python.
Formatting
To convert your compiled circuit into its textual representation, use the str
function:
If you just want to see the output on your terminal, you can directly print it as well:
Formatting is designed for debugging purpose only. It's not possible to create the circuit back from its textual representation. See How to Deploy if that's your goal.
Drawing
Drawing functionality requires the installation of the package with the full feature set. See the Installation section for instructions.
To draw your compiled circuit, use the draw
method:
This method draws the circuit, saves it as a temporary PNG file and returns the file path.
You can display the drawing in a Jupyter notebook:
Alternatively, you can use the show
option of the draw
method to display the drawing with matplotlib
:
Using this option will clear any existing matplotlib plots.
Lastly, to save the drawing to a specific path, use the save_to
option:
Last updated