Closed
Description
Bug report
When creating a legend with a pie graph using the GTK3Cairo
backend a TypeError is raised. The issue affects versions 3.0.0rc2, 3.0.0, 3.0.1, 3.0.2 but not 2.2.3. Likewise this exception is not raised with the backend is GTK3Agg
.
Code for reproduction
import matplotlib
matplotlib.rcParams['backend'] = 'GTK3Cairo'
import matplotlib.pyplot as plt
fig1, ax1 = plt.subplots()
ax1.pie(
(83, 14, 2),
colors=(
(0.75, 0.86, 1.0),
(0.49, 0.61, 0.73),
(0.24, 0.36, 0.47)
)
)
legend_bbox = fig1.legend(['Sample Text'])
legend_bbox.legendPatch.set_linewidth(0)
plt.show()
Actual outcome
Traceback (most recent call last):
File "<redacted>/.venv/lib/python3.6/site-packages/matplotlib/backends/backend_gtk3cairo.py", line 33, in on_draw_event
self._render_figure(allocation.width, allocation.height)
File "<redacted>/.venv/lib/python3.6/site-packages/matplotlib/backends/backend_gtk3cairo.py", line 21, in _render_figure
self.figure.draw(self._renderer)
File "<redacted>/.venv/lib/python3.6/site-packages/matplotlib/artist.py", line 50, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "<redacted>/.venv/lib/python3.6/site-packages/matplotlib/figure.py", line 1649, in draw
renderer, self, artists, self.suppressComposite)
File "<redacted>/.venv/lib/python3.6/site-packages/matplotlib/image.py", line 138, in _draw_list_compositing_images
a.draw(renderer)
File "<redacted>/.venv/lib/python3.6/site-packages/matplotlib/artist.py", line 50, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "<redacted>/.venv/lib/python3.6/site-packages/matplotlib/legend.py", line 646, in draw
self.legendPatch.draw(renderer)
File "<redacted>/.venv/lib/python3.6/site-packages/matplotlib/artist.py", line 50, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "<redacted>/.venv/lib/python3.6/site-packages/matplotlib/patches.py", line 535, in draw
renderer.draw_path(gc, tpath, affine, rgbFace)
File "<redacted>/.venv/lib/python3.6/site-packages/matplotlib/backends/backend_cairo.py", line 239, in draw_path
_append_path(ctx, path, transform, clip)
File "<redacted>/.venv/lib/python3.6/site-packages/matplotlib/backends/backend_cairo.py", line 163, in _append_path
return _append_paths(ctx, [path], [transform], clip)
File "<redacted>/.venv/lib/python3.6/site-packages/matplotlib/backends/backend_cairo.py", line 104, in _append_paths_slow
*np.concatenate([cur / 3 + points[:2] * 2 / 3,
TypeError: unsupported operand type(s) for /: 'tuple' and 'int'
Traceback (most recent call last):
File "<redacted>/.venv/lib/python3.6/site-packages/matplotlib/backends/backend_gtk3cairo.py", line 33, in on_draw_event
self._render_figure(allocation.width, allocation.height)
File "<redacted>/.venv/lib/python3.6/site-packages/matplotlib/backends/backend_gtk3cairo.py", line 21, in _render_figure
self.figure.draw(self._renderer)
File "<redacted>/.venv/lib/python3.6/site-packages/matplotlib/artist.py", line 50, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "<redacted>/.venv/lib/python3.6/site-packages/matplotlib/figure.py", line 1649, in draw
renderer, self, artists, self.suppressComposite)
File "<redacted>/.venv/lib/python3.6/site-packages/matplotlib/image.py", line 138, in _draw_list_compositing_images
a.draw(renderer)
File "<redacted>/.venv/lib/python3.6/site-packages/matplotlib/artist.py", line 50, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "<redacted>/.venv/lib/python3.6/site-packages/matplotlib/legend.py", line 646, in draw
self.legendPatch.draw(renderer)
File "<redacted>/.venv/lib/python3.6/site-packages/matplotlib/artist.py", line 50, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "<redacted>/.venv/lib/python3.6/site-packages/matplotlib/patches.py", line 535, in draw
renderer.draw_path(gc, tpath, affine, rgbFace)
File "<redacted>/.venv/lib/python3.6/site-packages/matplotlib/backends/backend_cairo.py", line 239, in draw_path
_append_path(ctx, path, transform, clip)
File "<redacted>/.venv/lib/python3.6/site-packages/matplotlib/backends/backend_cairo.py", line 163, in _append_path
return _append_paths(ctx, [path], [transform], clip)
File "<redacted>/.venv/lib/python3.6/site-packages/matplotlib/backends/backend_cairo.py", line 104, in _append_paths_slow
*np.concatenate([cur / 3 + points[:2] * 2 / 3,
TypeError: unsupported operand type(s) for /: 'tuple' and 'int'
Expected outcome
The expected outcome is that a legend with the text "Sample Text" would be displayed and there would be no stack trace.
Matplotlib version
- Operating system: Fedora 28 x64
- Matplotlib version: 3.0.2 (Installed from PyPi with PIP)
- Matplotlib backend (
print(matplotlib.get_backend())
): GTK3Cairo - Python version: 3.6
- Jupyter version (if applicable): N/A
- Other libraries: N/A