3
$\begingroup$

How can I plot custom labels for specific qubits on the left and right side similar to the picture shown here (A, B, Sum ...):

$\endgroup$
2
$\begingroup$

A partial answer.

How to customize the labels of QuantumRegisters:

from qiskit import *

red_qubit = QuantumRegister(1,'red')
blue_qubit = QuantumRegister(1, 'blue')
green_qubit = QuantumRegister(2, 'green')

circuit = QuantumCircuit(red_qubit, blue_qubit, green_qubit)

circuit.h(red_qubit[0])
circuit.x(blue_qubit[0])
circuit.x(green_qubit[0])
circuit.cx(red_qubit[0], blue_qubit[0])
circuit.cx(red_qubit[0], green_qubit[0])
circuit.cx(red_qubit[0], green_qubit[1])

%matplotlib inline
circuit.draw(output="mpl")

The output:

| improve this answer | |
$\endgroup$

Your Answer

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