Formatting and drawing
Last updated
Last updated
You can convert your compiled circuit into its textual representation by converting it to string:
If you just want to see the output on your terminal, you can directly print it as well:
Formatting is just for debugging purposes. It's not possible to create the circuit back from its textual representation. See if that's your goal.
Drawing functionality requires the installation of the package with the full feature set. See the section to learn how to do that.
You can use the draw
method of your compiled circuit to draw it:
This method will draw the circuit on a temporary PNG file and return the path to this file.
You can show the drawing in a Jupyter notebook, like this:
Or, you can use the show
option of the draw
method to show the drawing with matplotlib
.
Beware that this will clear the matplotlib plots you have.
Lastly, you can save the drawing to a specific path: