I tried to plot a Bloch vector. However, my Bloch sphere is appearing as an ellipse/oval instead of a circle. I am having the same issues with qsphere also. Image instead of this

from qiskit.visualization import plot_bloch_vector

%matplotlib inline

plot_bloch_vector([0,1,0], title="New Bloch Sphere")
  • 2
    $\begingroup$ An issue has been opened for this problem: github.com/Qiskit/qiskit-terra/issues/4770. It looks like it might be an issue with a specific matplotlib version $\endgroup$ Aug 6 '20 at 15:07
  • 1
    $\begingroup$ Thank You. I changed my version of Matplotlib from 3.3.0 to 3.2.2 and it solved the problem. $\endgroup$ Aug 7 '20 at 19:31

UPDATE: Qiskit Terra 0.16 (release Oct 2020) fixes this issue.

I just merged PR 4893, fixing this issue in coming Qiskit Terra 0.16. This closes 4905 and 4893 (reporting this very same problem) by setting the correct aspecting ration when Matplotlib installed is 3.3.0 or above. This issue was introduced by Matplotlib 3.3 as part of a fix.

TL;DR: Problem introduce by MPL 3.3.0 that will be fixed in Qiskit Terra 0.16. In the meanwhile, you can downgrade to MPL 3.2 as a workaround.


Your Answer

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

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