1
$\begingroup$

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.

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)))

outputs: enter image description here

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.