-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Open
Labels
backend: svgkeepItems to be ignored by the “Stale” Github ActionItems to be ignored by the “Stale” Github Action
Milestone
Description
Bug report
Bug summary
I've passed urls
arg in the Axes.pcolormesh()
method to set URLs in a QuadMesh, but when I save it to SVG the URLs are missing.
I traced it to the RendererBase.draw_quad_mesh()
method which passes [None]
as the urls argument to self.draw_path_collection()
.
Code for reproduction
import numpy as np
import matplotlib.pyplot as plt
nan = np.nan
data = np.array([[nan, 4, nan], [2, 7, 5], [nan, 8, nan]])
links = np.array([[nan, 'http://abc.com/', nan],
['http://cnn.com/', 'http://nbc.com/', 'http://cbs.com/'],
[nan, 'http://nytimes.com',]])
fig = plt.figure()
ax = plt.gca()
mesh = ax.pcolormesh(data, urls=links)
fig.savefig('/tmp/test_links.svg')
Actual outcome
$ fgrep http /tmp/test_link.svg
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Created with matplotlib (http://matplotlib.org/) -->
<svg height="288pt" version="1.1" viewBox="0 0 432 288" width="432pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
Expected outcome
The URLs are inserted into the quadmesh element like this:
<g id="QuadMesh_1">
<a xlink:href="url"> <path> /* the path */ </path> </a>
<a xlink:href="url"> <path> /* the path */ </path> </a>
</g>
Matplotlib version
- Operating system: Linux
- Matplotlib version: 2.2.2
- Matplotlib backend (
print(matplotlib.get_backend())
): module://ipykernel.pylab.backend_inline, but SVG is what I care about - Python version: 3.5.3
- Jupyter version (if applicable): 4.4.0
- Other libraries:
matplotlib is installed in a virtualenv with pip.
Metadata
Metadata
Assignees
Labels
backend: svgkeepItems to be ignored by the “Stale” Github ActionItems to be ignored by the “Stale” Github Action