Skip to content

Zero size figure use case #17093

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

Closed
Abbath opened this issue Apr 10, 2020 · 2 comments · Fixed by #17610
Closed

Zero size figure use case #17093

Abbath opened this issue Apr 10, 2020 · 2 comments · Fixed by #17610
Milestone

Comments

@Abbath
Copy link

Abbath commented Apr 10, 2020

Bug report

Bug summary
I use matplotlib + PyQt5. The figure is placed inside a QSplitter (a standard Qt widget that consists of several vertical or horizontal parts which can be resized by handles between those parts) . When a part of QSplitter shrinks to a zero size it automatically resizes the widget it contains. Matplotlib raises an error as was mentioned in #16687.

Actual outcome

ValueError: figure size must be positive finite not [17.45  0.  ]

Expected outcome

A zero height figure.

Matplotlib version

  • Operating system: Kubuntu 19.10
  • Matplotlib version: >=3.2.0 (installed by pip)
  • Matplotlib backend: Qt5Agg
  • Python version: 3.6.9
  • Other libraries: PyQt5
@tacaswell tacaswell added this to the v3.2.2 milestone Apr 10, 2020
@tacaswell
Copy link
Member

Fair enough.

I guess we need some checks for 0 size to bail as quickly as possible and make sure we don't segfault libpng in 3.2.x.

@anntzer
Copy link
Contributor

anntzer commented Apr 11, 2020

It didn't segfault libpng (we had a RuntimeError instead, afaict) and doesn't cause any problems (well, other than a SystemError) with Pillow. (I think especially on 3.3+ we should just propagate out whatever exception Pillow generates; if people want some other exception for zero-sized figure they should just argue about that on the Pillow tracker.)

@tacaswell tacaswell modified the milestones: v3.2.2, v3.4.0, v3.3.0 Jun 10, 2020
tacaswell added a commit to tacaswell/matplotlib that referenced this issue Jun 10, 2020
This can happen if the figure is embedded in a larger GUI application.

Closes matplotlib#17093
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 a pull request may close this issue.

3 participants