Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Bloch sphere distortion #1496

Merged
merged 1 commit into from Apr 12, 2021
Merged

Fix Bloch sphere distortion #1496

merged 1 commit into from Apr 12, 2021

Conversation

BoxiLi
Copy link
Member

@BoxiLi BoxiLi commented Apr 11, 2021

Matplotlib stopped to stretch the plot to fit it in a square box from 3.3.0. We do it manually. See https://matplotlib.org/3.3.0/users/whats_new.html#d-axes-improvements

Description
To reproduce

import numpy as np
from qutip import Bloch

b = Bloch()
xp = [np.cos(th) for th in np.linspace(0, 2*np.pi, 20)]
yp = [np.sin(th) for th in np.linspace(0, 2*np.pi, 20)]
zp = np.zeros(20)
pnts = [xp, yp, zp]
b.add_points(pnts)
b.show()

before:
image

after:
image

Related issues or PRs
fix #1385

Changelog
Fix Bloch sphere distortion

Matplotlib stopped to stretch the plot to fit it in a square box from 3.3.0. We do it manually. See https://matplotlib.org/3.3.0/users/whats_new.html#d-axes-improvements
@jakelishman
Copy link
Member

jakelishman commented Apr 11, 2021

If only this had come an hour sooner! Making a new release of code is pretty straightforwards now, though, so we can fold this and some other bits and bobs into a patch release in a week or two's time.

@BoxiLi
Copy link
Member Author

BoxiLi commented Apr 11, 2021

😆 Well, technically we still need to wait for the test.

Glad to see 4.6.0 online!

@coveralls
Copy link

Coverage Status

Coverage increased (+0.002%) to 64.118% when pulling f635fb8 on BoxiLi:bloch-sphere-ratio into 22f8be4 on qutip:master.

@BoxiLi BoxiLi merged commit 67c4687 into qutip:master Apr 12, 2021
@jakelishman jakelishman added this to the QuTiP 4.6.2 milestone May 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bloch sphere deformed for matplotlib >= 3.3.0
4 participants