-
Notifications
You must be signed in to change notification settings - Fork 105
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
pyzx.draw()
does not work in some matplotlib environments
#222
Comments
If I explicitly call |
dlyongemallo
added a commit
to dlyongemallo/pyzx
that referenced
this issue
May 5, 2024
… matplotlib environments. Fixes Quantomatic#222.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am embedding a ZX diagram into a web app (using shiny), and calling
pyzx.draw(g)
results in an error'NoneType' object has no attribute 'rowspan'
.The cause is due to the way that PyZX is creating the figure in these lines, which does not set
matplotlib.gridspec.SubplotSpec
properly.Some matplotlib environments ignore this silently, but in others this causes an error. For example, this fails also in the latest version of pandas (see this issue and this Stack Overflow answer).
This can be fixed by calling
subplots
instead:But I think this might result in a slightly different appearance in some environments, as the axes are computed rather than explicitly set. Were the original values
[0, 0, 1, 1]
explicitly chosen to force a particular appearance? Otherwise, it seems it's likely more robust to let them be computed based on the environment.The text was updated successfully, but these errors were encountered: