Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed
Milestone
Description
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
Labels
No labels