This is a duplicate of a question that was asked on the Cirq issues page. I'm duplicating this question to increase it's visibility.
In Cirq, how do you display circuit diagrams that are "prettier" than the ones displayed by default?
Asked
Active
Viewed 2,370 times
1 Answers
1
The standard way to print circuits in Cirq is by calling print(circuit): which prints the text diagram representation of the circuit. A "prettier" representation can be displayed with SVGCircuit. In a Jupyter notebook,
import cirq
from cirq.contrib.svg import SVGCircuit
a, b = cirq.LineQubit.range(2)
SVGCircuit(cirq.Circuit(cirq.X(a), cirq.CNOT(a,b)))
SVGCircuit is a work-in-progress. Please add comments explaining what problems you run into on the Circuit.repr_svg with nice diagrams for ipython issue.
Victory Omole
- 2,332
- 1
- 10
- 24
