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

RuntimeError: Cannot get window extent w/o renderer #10874

Closed
Milestone
@desowin

Description

@desowin

Bug report

Bug summary

Matplotlib 2.2.0 seems to introduce regression regarding the use ofAgg renderer. In specific cases, get_window_extent() does raiseRuntimeError: Cannot get window extent w/o renderer.

Code for reproduction

#!/usr/bin/env python3importmatplotlibmatplotlib.use('Agg')importmatplotlib.pyplotaspltfig=plt.figure()ax=fig.add_subplot(111,frameon=True)ax.plot()# If the call to draw() below is removed, everything works# However, this line cases xtick and ytick get_window_extent()# to raise 'RuntimeError: Cannot get window extent w/o renderer'# on matplotlib 2.2.0 (tested also on 2.2.2)## Moreover, this works just fine with and without the call to# draw() below, with matplotlib 2.1.2plt.get_current_fig_manager().canvas.draw()ax.set_xlabel(ax.get_xlabel()).get_window_extent()ax.set_ylabel(ax.get_ylabel()).get_window_extent()forxtickinax.get_xticklabels():xtick.get_window_extent()forytickinax.get_yticklabels():ytick.get_window_extent()

Actual outcome

Traceback (most recent call last):  File "matplotlib-bug.py", line 22, in <module>    xtick.get_window_extent()  File "/usr/lib/python3.6/site-packages/matplotlib/text.py", line 920, in get_window_extent    raise RuntimeError('Cannot get window extent w/o renderer')RuntimeError: Cannot get window extent w/o renderer

Expected outcome

No exception should be raised. No exception is raised when the code is used with matplotlib 2.1.2.

Matplotlib version

  • Operating system: Arch Linux
  • Matplotlib version: 2.2.2
  • Matplotlib backend (print(matplotlib.get_backend())): agg
  • Python version: 3.6.4

Installed withpacman -S python python-matplotlib. Tested against older version of matplotlib by installing them in virtualenv using pip.

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