# Custom labelling of randomly generated unitaries in Qiskit

I'm writing a program in Qiskit involving the generation of Haar-random unitaries. Is there a way to label each unitary such that the label appears instead of 'unitary' when I draw the circuit?

qc = qiskit.QuantumCircuit(2,1)
randUnitary = qiskit.quantum_info.random_unitary(4)
qc.append(randUnitary,[0,1])
qc.draw()


Yeah, you can assign a label to a Gate or an Instruction object for this. For example, something like:

from qiskit import QuantumCircuit
from qiskit.extensions import UnitaryGate
from qiskit.quantum_info import random_unitary

qc = QuantumCircuit(2,1)
randUnitary = UnitaryGate(random_unitary(4), label='My Special Unitary')
qc.append(randUnitary, [0,1])
qc.draw()


which yields