I'm using Qiskit to demonstrate some circuits, and I want to change the position of some gates for better representation.

For example, look at this circuit: enter image description here

I'd like for the last $R_x(\frac{-\pi}{2})$ to align with the last Hadamard gate. Is there a way to do this without using barriers?


1 Answer 1


The justify= parameter might help.

qc.draw('mpl', reverse_bits=True, justify='right')

enter image description here

Other option is to add the barrier and then remove them from the plot (though that will skip all the barriers)

qc.rx(-pi/2, 0)
qc.draw('mpl', reverse_bits=True, plot_barriers=False)

enter image description here

  • $\begingroup$ The adding barrier then removing it seems like a good solution. Thanks a lot! $\endgroup$
    – A. Jahin
    Commented Sep 26, 2020 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.