# Is there a way to use titles on circuit drawing?

As you may know, one can use barriers in Qiskit to seperate gates on a circuit in a proper way. So, I was wondering is there a way to give a title to these "sections" seperated by barriers?

I provide an example in Figure below. Titles does not need to be exactly same with the ones in the Figure. It is just an example.

The short answer is that the circuit drawer does not have a way to label "sections".

However, you can pass an arbitrary matplotlib.axes.Axes to the Matplotlib circuit drawer (only to that circuit drawer) where you can set and position your labels by hand. For your particular case, it looks something like this:

from matplotlib.pyplot import figure

fig = figure()
height = 0.8
ax.text(-0.9, height, 'entanglement', size=14)
ax.text(2.5, height, 'init', size=14)
ax.text(4.5, height, 'transfer of\namplitudes', size=14)
ax.text(7, height, 'measurement', size=14)

circuit.draw('mpl', ax=ax)


You might have to adapt the x and y numbers (the first two parameters for text) to readjust their position.

• I was looking for a built-in method which can automatically determine the positions of labels according to the barrier placements. But I guess this is the best solution we have right now. I appriciate your time and effort:)
– Saba
Mar 14 '21 at 10:14
• Sorry, no build-in. The ax parameter was design as a catch-all for these use cases... Mar 14 '21 at 21:31