# How to draw the given qnode with the detailed quantum gates using pennylane templates

**URL:** https://discuss.pennylane.ai/t/how-to-draw-the-given-qnode-with-the-detailed-quantum-gates-using-pennylane-templates/5011
**Category:** PennyLane Help
**Created:** [August 4, 2024, 8:16am UTC](https://discuss.pennylane.ai/t/how-to-draw-the-given-qnode-with-the-detailed-quantum-gates-using-pennylane-templates/5011 "2024-08-04T08:16:21Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![yousrabou](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/yousrabou/32/1581_2.png) [@yousrabou](https://discuss.pennylane.ai/u/yousrabou)
#### Post date: [August 4, 2024, 8:16am UTC](https://discuss.pennylane.ai/t/how-to-draw-the-given-qnode-with-the-detailed-quantum-gates-using-pennylane-templates/5011/1 "2024-08-04T08:16:21Z")

</div>

Hi Pennylane community,

As a beginner using this amazing tool, I would like to know how I can draw my quantum circuit with detailed quantum gates using Pennylane templates such as AngleEmbedding, BasicEntangledLayers, QFT, etc.

```auto
def circuit(inputs, weights):
            qml.templates.AngleEmbedding(inputs, wires=range(3))
            qml.templates.BasicEntanglerLayers(weights, wires=range(3))
            return [qml.expval(qml.PauliZ(wires=w)) for w in range(3)]
X=[1,2,3]
weights=[pi, pi, pi]
weights = np.reshape(weights, (1, -1))
qml.drawer.use_style("pennylane")
fig, ax = qml.draw_mpl(circuit)(X,weights)

```

![download](https://canada1.discourse-cdn.com/flex012/uploads/pennylane/original/2X/a/a7fabb4741e3b7c8cfbf3b180c1afc819ffb42e1.png)

---

<div class="post-metadata">

### Author: ![CatalinaAlbornoz](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/catalinaalbornoz/32/1196_2.png) [@CatalinaAlbornoz](https://discuss.pennylane.ai/u/CatalinaAlbornoz)
#### Post date: [August 6, 2024, 9:10pm UTC](https://discuss.pennylane.ai/t/how-to-draw-the-given-qnode-with-the-detailed-quantum-gates-using-pennylane-templates/5011/2 "2024-08-06T21:10:51Z")

</div>

Hi @yousrabou ,

Welcome to the Forum, and great question!

The first thing you would need to do is turn your circuit into a QNode. Directly above the definition of your circuit you can add `@qml.qnode(dev)`. This way you will attach the circuit to the `dev` device.

```auto
dev = qml.device("default.qubit")
@qml.qnode(dev)
def circuit(inputs, weights):
...

```

Now you can add a `level` keyword argument when you’re making the drawing:

```auto
fig, ax = qml.draw_mpl(circuit,level=None,decimals=1)(X,weights);

```

In this case I also added a `decimals` keyword argument to get the value of the angles applied in each gate.

 ![image](https://canada1.discourse-cdn.com/flex012/uploads/pennylane/original/2X/7/782d8922b042f93879f26d4c5a40b6ca691e3fac.png)

You can check out the Usage details section of the [qml.drawer.draw\_mpl() documentation](https://docs.pennylane.ai/en/stable/code/api/pennylane.drawer.draw_mpl.html) to learn more about the `levels` keyword argument.

💡 Pro tip  
You don’t need to write `qml.templates.AngleEmbedding`. You can simply write `qml.AngleEmbedding` (slightly shorter) and it will work in the same way!

Feel free to post any other questions you have! This was a great question.

---

<div class="post-metadata">

### Author: ![yousrabou](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/yousrabou/32/1581_2.png) [@yousrabou](https://discuss.pennylane.ai/u/yousrabou)
#### Post date: [October 4, 2024, 9:26am UTC](https://discuss.pennylane.ai/t/how-to-draw-the-given-qnode-with-the-detailed-quantum-gates-using-pennylane-templates/5011/3 "2024-10-04T09:26:51Z")

</div>

Hello, madame

I appreciate your detailed reply and tips; they have been really helpful.
