Title: Various issues with miter limits · Issue #9830 · matplotlib/matplotlib · GitHub
Open Graph Title: Various issues with miter limits · Issue #9830 · matplotlib/matplotlib
X Title: Various issues with miter limits · Issue #9830 · matplotlib/matplotlib
Description: Noticed this a while ago (while implementing mplcairo) but prompted to report due to #9829: from matplotlib import pyplot as plt, ticker fig, axs = plt.subplots(4, 4) for i, ax in enumerate(axs.flat): ax.xaxis.set_major_locator(ticker.Nu...
Open Graph Description: Noticed this a while ago (while implementing mplcairo) but prompted to report due to #9829: from matplotlib import pyplot as plt, ticker fig, axs = plt.subplots(4, 4) for i, ax in enumerate(axs.fla...
X Description: Noticed this a while ago (while implementing mplcairo) but prompted to report due to #9829: from matplotlib import pyplot as plt, ticker fig, axs = plt.subplots(4, 4) for i, ax in enumerate(axs.fla...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/9830
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Various issues with miter limits","articleBody":"Noticed this a while ago (while implementing mplcairo) but prompted to report due to #9829:\r\n\r\n```\r\nfrom matplotlib import pyplot as plt, ticker\r\n\r\nfig, axs = plt.subplots(4, 4)\r\nfor i, ax in enumerate(axs.flat):\r\n ax.xaxis.set_major_locator(ticker.NullLocator())\r\n ax.yaxis.set_major_locator(ticker.NullLocator())\r\n ax.plot([-1, 0, 1], [0, 1, 0], lw=i, solid_joinstyle=\"miter\")\r\n ax.set(xlim=(-15, 15), ylim=(0, 3))\r\n\r\nfig.savefig(\"/tmp/test.png\")\r\nfig.savefig(\"/tmp/test.svg\")\r\nfig.savefig(\"/tmp/test.pdf\")\r\n\r\nplt.show()\r\n```\r\n\r\npdf appears to respect the miter (\"pointed\") joinstyle (funnily this appears to behave in the opposite manner as #9829):\r\n\r\nsvg appears to ignore it:\r\n\r\nagg changes its mind half-way:\r\n\r\n\r\nThe behavior of agg is almost certainly due to a misunderstanding in how the miter limit is set. See https://www.w3schools.com/tags/canvas_miterlimit.asp and https://www.cairographics.org/manual/cairo-cairo-t.html#cairo-set-miter-limit for the definition of the miter limit. Note that the two definitions differ: html defines it in absolute lengths whereas cairo defines it relative to the linewidth.\r\n\r\nbackend_agg.h has the line (multiple times)\r\n```\r\nstroke.miter_limit(points_to_pixels(gc.linewidth));\r\n```\r\nwhich suggest that the author thought miter_limit takes an absolute miter limit, but in fact a relative miter limit should have been given (how do I know this? because I can reproduce the same behavior with mplcairo with the same setting, and cairo clearly documents that it uses a relative miter limit :-)).\r\n\r\nSo the current implementation ends up switching from miter join to bevel join at an angle that depends on the linewidth, eek.\r\n\r\n---\r\n\r\nNOTE: when this is fixed, remember to regen the logo per #14939 (which also showcases the issue).","author":{"url":"https://github.com/anntzer","@type":"Person","name":"anntzer"},"datePublished":"2017-11-22T03:58:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/9830/matplotlib/issues/9830"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3afa861d-401e-119c-0405-02d0bafc218e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D854:1A54AB:237734D:31222FE:6A50BAE8 |
| html-safe-nonce | d34bea67902d1f797301963fe44e4dc37604ddb13d5c9d382d79bbb15441b2ca |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEODU0OjFBNTRBQjoyMzc3MzREOjMxMjIyRkU6NkE1MEJBRTgiLCJ2aXNpdG9yX2lkIjoiNjgyMTE2NzU2Mjk1MTcwNzkyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 5b4a4f0bcdef85cf41c5230d8f6ea51462eefe6309a29808d26c3d6bdb35d580 |
| hovercard-subject-tag | issue:275937629 |
| 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/_view_fragments/issues/show/matplotlib/matplotlib/9830/issue_layout |
| twitter:image | https://opengraph.githubassets.com/621ed33034583a61c9fb54d16413de2f841d468925dc36319f6bd52048c0e942/matplotlib/matplotlib/issues/9830 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/621ed33034583a61c9fb54d16413de2f841d468925dc36319f6bd52048c0e942/matplotlib/matplotlib/issues/9830 |
| og:image:alt | Noticed this a while ago (while implementing mplcairo) but prompted to report due to #9829: from matplotlib import pyplot as plt, ticker fig, axs = plt.subplots(4, 4) for i, ax in enumerate(axs.fla... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | anntzer |
| hostname | github.com |
| expected-hostname | github.com |
| None | 72b13e0e8d0319acdd27a145cfe73f4f06c791713d0ac4690e41fb68ad28cac0 |
| turbo-cache-control | no-preview |
| 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 | 08e79d53fc070870d5b168356afebb1e286a2ffe |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width