Skip to content

Zero size figure use case #17093

Closed
Closed

Description

@Abbath

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

Activity

  1. added this to the v3.2.2 milestone on Apr 10, 2020
  2. tacaswell commented on Apr 10, 2020

    @tacaswell
    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.

  3. anntzer commented on Apr 11, 2020

    @anntzer
    Contributor

    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.)

  4. modified the milestones: v3.2.2, v3.4.0, v3.3.0 on Jun 10, 2020
  5. added a commit that references this issue on Jun 10, 2020
    4b3301f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions