Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Crash when interactively adding a number of subplots #11123

Closed
Milestone
@mdovgialo

Description

@mdovgialo

Bug report

Bug summary

Adding subplots repeatedly to a figure in interactive mode can sometimes crash Matplotlib version 2.2.2, in version 2.0.2 everything works. Sometimes it does not crash, but when you resize figure's window to make it significantly smaller it crashes every time. I'm using Matplotlib on Kubuntu 16.04 64 bit with Python 3.5.2.

Code for reproduction

importmatplotlib.pyplotaspltimporttimeplt.ion()deftest_subplot_crash_with_matplotlib222():plt.ion()importmatplotlibprint("Matplotlib ver",matplotlib.__version__)fig=plt.figure()fig.set_size_inches(10,10)foriinrange(100):ax=fig.add_subplot(10,10,i+1)ax.plot([0,1], [0,1])fig.tight_layout()fig.canvas.flush_events()print(i)time.sleep(0.01)ifi==25:fig.set_size_inches(3,3)plt.ioff()plt.show()if__name__=='__main__':test_subplot_crash_with_matplotlib222()

Actual outcome

While adding 25th subplot it crashes. You can crash it earlier if you manually resize the window to make it smaller.

Traceback (most recent call last):  File "tests/test_crash_matplotlib222.py", line 28, in <module>    test_subplot_crash_with_matplotlib222()  File "tests/test_crash_matplotlib222.py", line 18, in test_subplot_crash_with_matplotlib222    ax = fig.add_subplot(10, 10, i+1)  File "/home/marian/.local/lib/python3.5/site-packages/matplotlib/figure.py", line 1239, in add_subplot    a = subplot_class_factory(projection_class)(self, *args, **kwargs)  File "/home/marian/.local/lib/python3.5/site-packages/matplotlib/axes/_subplots.py", line 77, in __init__    self._axes_class.__init__(self, fig, self.figbox, **kwargs)  File "/home/marian/.local/lib/python3.5/site-packages/matplotlib/axes/_base.py", line 488, in __init__    raise ValueError('Width and height specified must be non-negative')ValueError: Width and height specified must be non-negative

Expected outcome
Interactive matplotlib window with dynamically added 100 plots. While plots are being added window should be resizable. After 25'th plot it will make itself smaller in an effort to reproduce the bug. In Matplotlib version 2.0.2 it works without crashing.

Matplotlib version

  • Operating system: Kubuntu 16.04 64 bit, Linux 4.13.0-38-genericFix git instructions on matplotlib.sf.net #43~16.04.1-Ubuntu SMP Wed Mar 14 17:48:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
  • Matplotlib version: 2.2.2
  • Matplotlib backend (print(matplotlib.get_backend())): TkAgg
  • Python version: 3.5.2

Installed matplotlib using:
pip3 install --user matplotlib==2.2.2

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp