TransWikia.com

How to change the names of the registers displayed with circuit_drawer (output='mpl')

Quantum Computing Asked by tribluralux on December 17, 2020

I am trying to change the appearance of the circuit_drawer in output=’mpl’ mode. The registers of the Quantum Circuit are named like ($q0_0$, $q0_1$, $q1_0$, $q2_0$, $q2_1$,..) but I’d like to name them myself. I can’t find a style function or option which is able to do that… any ideas?

To be clear what I would like to change:

enter image description here

One Answer

When initializing the registers for the quantum circuit you need to set the parameter 'name'. For example:

f_in = QuantumRegister(n, name='f_in')
###add other registers here### 
qc = QuantumCircuit(f_in, ...)
qc.draw(ouput='mpl')

Gives the output:

enter image description here

Answered by tribluralux on December 17, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP