Title: Issue · GitHub
Open Graph Title: Issue · matplotlib/matplotlib
X Title: Issue · matplotlib/matplotlib
Description: matplotlib: plotting with Python. Contribute to matplotlib/matplotlib development by creating an account on GitHub.
Open Graph Description: matplotlib: plotting with Python. Contribute to matplotlib/matplotlib development by creating an account on GitHub.
X Description: matplotlib: plotting with Python. Contribute to matplotlib/matplotlib development by creating an account on GitHub.
Opengraph URL: https://github.com/matplotlib/matplotlib
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"set_url() without effect in the plot for instances of Tick","articleBody":"### Bug report\r\n\r\n**Bug summary**\r\n\r\nUsing SVG back-end, setting the url attribute in objects of class Tick does nothing regarding the final plot, whereas it does for other objects.\r\n\r\n**Code for reproduction**\r\n\r\nIt is an extension of the [hyperlinks example](https://github.com/matplotlib/matplotlib/blob/master/examples/misc/hyperlinks_sgskip.py) to\r\nto deal with hyperlinks in the ticks:\r\n\r\n```python\r\nimport matplotlib as mpl\r\nmpl.use('SVG')\r\nimport matplotlib.pyplot as plt\r\n\r\nf = plt.figure()\r\nax = f.gca()\r\ns = plt.scatter([1, 2, 3], [4, 5, 6])\r\ns.set_urls(['http://www.bbc.co.uk/news', 'http://www.google.com', None])\r\nfor tick, pos, label in ax.yaxis.iter_ticks():\r\n tick.set_url('http://www.python.org')\r\n print(tick.get_url(), pos, label)\r\nf.savefig('scatter.svg')\r\n```\r\n\r\n**Actual outcome**\r\n\r\nI get:\r\n\r\n```\r\nhttp://www.python.org 3.75 3.75\r\nhttp://www.python.org 4.0 4.00\r\nhttp://www.python.org 4.25 4.25\r\n.....\r\nhttp://www.python.org 6.25 6.25\r\n```\r\nSo it properly changes the `url` attribute. Unfortunately, the svg file generated has no trace of the ticks hyperlinks:\r\n\r\n```\r\n\u003e grep python scatter.svg\r\n\u003e\r\n```\r\n...while it does for the scatter plot links, for instance:\r\n\r\n```\r\n \u003e egrep google scatter.svg\r\n \u003ca xlink:href=\"http://www.google.com\"\u003e\r\n```\r\n\r\n**Expected outcome**\r\n```\r\n\u003e egrep python scatter.svg\r\n \u003ca xlink:href=\"http://www.python.org\"\u003e\r\n \u003ca xlink:href=\"http://www.python.org\"\u003e\r\n.....\r\n \u003ca xlink:href=\"http://www.python.org\"\u003e\r\n```\r\n\r\n**Matplotlib version**\r\n * Operating system:\r\n * Matplotlib version: current dev ('2.1.0.post658.dev0+g39694f2)\r\n * Matplotlib backend: SVG \r\n * Python version: 3.6.3\r\n\r\n\u003c!--Please tell us how you installed matplotlib and python e.g., from source, pip, conda--\u003e\r\n\u003c!--If you installed from conda, please specify which channel you used if not the default--\u003e\r\n\r\n**Posible cause and suggested solution**\r\nI traced the problem to the Trick class, where the `url` attribute is not passed to any of the objects that are to be drawn. My successful workaround has been to override the `set_url()` method in the class Tick to transfer the `url` attribute content to the tick labels, that are to be drawn. I'll prepare a PR with this simple solution to be evaluated.","author":{"url":"https://github.com/khyox","@type":"Person","name":"khyox"},"datePublished":"2017-11-06T04:45:26.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/9695/matplotlib/issues/9695"}
| route-pattern | /:user_id/:repository/issues/:id(.:format) |
| route-controller | issues |
| route-action | show |
| fetch-nonce | v2:819e141e-f104-83dc-9e35-298935cb4a7d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 94EA:3A8CAE:17BCB22:20ABB49:6A55E0F8 |
| html-safe-nonce | 055f5388ed399b561dcf29e68cd717bb9f84d9209e80b1caa80a43e9e30f5818 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NEVBOjNBOENBRToxN0JDQjIyOjIwQUJCNDk6NkE1NUUwRjgiLCJ2aXNpdG9yX2lkIjoiNDY1NjQ1MzUyMDg5OTU2Mzc2OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c69d8aec470fe11ec18e743e7223cb605e8be15f6ceb9575491d46f1ce96ba05 |
| hovercard-subject-tag | repository:1385122 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/matplotlib/matplotlib/issues/9695 |
| twitter:image | https://opengraph.githubassets.com/b59581e94f4bc062489656248bb9ddb84dc58fb6b29928cd081cfebca96c6352/matplotlib/matplotlib |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b59581e94f4bc062489656248bb9ddb84dc58fb6b29928cd081cfebca96c6352/matplotlib/matplotlib |
| og:image:alt | matplotlib: plotting with Python. Contribute to matplotlib/matplotlib development by creating an account on GitHub. |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b5665c84831ed9ac4fb79519c16c9c5580ba8092fb8bb6e3e72972ec7197348e |
| turbo-cache-control | no-cache |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3725c7f9b2a6e3a27ef57c5aed13428c0f65e045 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width