Any way to draw my quantum circuit?

Hi! I was wondering if there’s any way to print out my circuit so that my circuit is same as what I was meant to design. Since there is no insert strategy for gates (such as the ones in Cirq), I am not sure whether my quantum circuit is designed in the way I was thinking.

Hi @Leeseok_Kim! You can use the QNode.print_applied() method to print out the gates applied by the QNode after each evaluation.

We’re also currently working on adding a circuit drawing feature as well :slightly_smiling_face:

1 Like

For example:

dev = qml.device('default.qubit', wires=2)

def circuit(x):
    qml.RZ(x, wires=0)
    qml.RY(x, wires=1)
    return qml.expval(qml.PauliZ(1))


will give the output

RZ(0.543, wires=0)
RY(0.543, wires=1)


Hi- thanks! Also, I have a few questions on designing quantum circuits. Is there any way that I can contact with you in easier/faster way other than this forum? If there’s not, this forum would be fine with me.

This forum would likely be the faster way, since it is checked by various PennyLane developers β€” so if I don’t see your reply straight away, someone else would be able to reply in the meantime :slight_smile:

In addition, you can also join our Slack channel: the link is

To follow on from your original question, you can also directly access the Cirq circuit object; it is available via dev.circuit. With this object, you can perform standard Cirq circuit drawing.

Hi @Leeseok_Kim!
Well, I am a novice in quantum machine learning and you may already be familiar with what I am mentioning, but since it was an interesting observation, I thought of sharing it here. While working on the paper by (Mari et al., 2019), I was curious to plot the circuit graphically. I tried to sketch it manually on understanding the algorithm, but when I connected to the actual IBMQ quantum hardware to execute the circuit, it was interesting to obtain a colourful circuit plot from the IBMQ website (refer to the results dashboard). One can easily save the plot from there.

Hi @Leeseok_Kim and @angelinaG,

the upcoming version of PennyLane will include a circuit drawer comparable to the one included in Cirq. If you want to try it before the new version is released, you can install PennyLane from the current master branch on Github via

pip install git+

Assume you already defined a QNode named circuit. The circuit drawer is then used in the following way:

>>> result = circuit(args)
>>> print(circuit.draw())
0: ──H──╭C───────────────────────────╭C─────────╭─ ⟨Z βŠ— Z⟩
1: ─────╰RX(2.3)──Rot(1.2, 3.2, 0.7)──╰RX(-2.3)──╰─ ⟨Z βŠ— Z⟩

The format is somewhat skewed in this forum, but it will look good in the console!


This is very interesting to note @johannesjmeyer!
Thank you very much!
I shall try this out! :+1: