Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Open
Description
Bug report
Bug summary
I've passedurls
arg in theAxes.pcolormesh()
method to set URLs in a QuadMesh, but when I save it to SVG the URLs are missing.
I traced it to theRendererBase.draw_quad_mesh()
method which passes[None]
as the urls argument toself.draw_path_collection()
.
Code for reproduction
importnumpyasnpimportmatplotlib.pyplotaspltnan=np.nandata=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> <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.