Title: capstyle/joinstyle support for matplotlib.collections.Collection · Issue #8277 · matplotlib/matplotlib · GitHub
Open Graph Title: capstyle/joinstyle support for matplotlib.collections.Collection · Issue #8277 · matplotlib/matplotlib
X Title: capstyle/joinstyle support for matplotlib.collections.Collection · Issue #8277 · matplotlib/matplotlib
Description: Bug report Bug summary matplotlib.collections.LineCollection does not support modifying cap style and join style. I found a similar problem description on stack exchange here, but no solution could be offered. Code for reproduction Any p...
Open Graph Description: Bug report Bug summary matplotlib.collections.LineCollection does not support modifying cap style and join style. I found a similar problem description on stack exchange here, but no solution could...
X Description: Bug report Bug summary matplotlib.collections.LineCollection does not support modifying cap style and join style. I found a similar problem description on stack exchange here, but no solution could...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/8277
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"capstyle/joinstyle support for matplotlib.collections.Collection","articleBody":"### Bug report\r\n\r\n**Bug summary**\r\n\r\nmatplotlib.collections.LineCollection does not support modifying cap style and join style. I found a similar problem description on stack exchange [here](http://stackoverflow.com/questions/11578760/matplotlib-control-capstyle-of-line-collection-large-number-of-lines), but no solution could be offered.\r\n\r\n**Code for reproduction**\r\n\r\nAny plot using collections.LineCollection, for instance a matplotlib.axes.Axes.errorbar plot. Here, the error bars are drawn using a LineCollection object and the ends of the error bars are square. It would be great if they could be changed to have round caps.\r\n\r\n```\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\nxs = np.linspace(0, 1)\r\nys = np.ones(xs.shape)\r\ndys = ys * 0.1\r\nfig = plt.figure()\r\nax = fig.add_subplot(1, 1, 1)\r\nax.errorbar(xs, ys, dys)\r\nfig.show()\r\n```\r\n\r\n**Actual outcome**\r\n\r\nAs expected, the LineCollection produces lines with the default cap and join styles of the renderer.\r\n\r\n**Expected outcome**\r\n\r\nThis would be a new feature and has never worked with matplotlib. It would be easy to implement and performance could remain the same if the matplotlib.collections.Collection base class could be modified to support setting a default cap style and join style for the whole collection.\r\n\r\nA simple fix would be to add \"gc.set_capstyle(...)\" and \"gc.set_joinstyle(...)\" to the Collection.draw method and add corresponding default values to the Collection object. Such a change would allow fixing the example above by adding a single line without modifying the errorbar-related code:\r\n\r\n```\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\nxs = np.linspace(0, 1)\r\nys = np.ones(xs.shape)\r\ndys = ys * 0.1\r\nfig = plt.figure()\r\nax = fig.add_subplot(1, 1, 1)\r\n_, _, col = ax.errorbar(xs, ys, dys)\\\r\ncol.set_capstyle('round')\r\nfig.show()\r\n```\r\n\r\n**Matplotlib version**\r\n\r\nMatplotlib 2.0.0 all platforms.\r\n\r\n","author":{"url":"https://github.com/blatts","@type":"Person","name":"blatts"},"datePublished":"2017-03-12T23:05:36.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/8277/matplotlib/issues/8277"}
| 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:88f43d8d-6987-3f48-1dba-b6a6bfb1259b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D8FA:C12A8:3ED3D5:559D12:6A514276 |
| html-safe-nonce | 20175ec765d9d69e6ce14fd8109905aa4458fa9c9cf3e03fb8842b847d0e4a76 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOEZBOkMxMkE4OjNFRDNENTo1NTlEMTI6NkE1MTQyNzYiLCJ2aXNpdG9yX2lkIjoiMzUyNDczNDE0MzgyMzk1NDU1MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 61f766beea24028c70f9162fdc48b82d33b471ff1c46b701db2bd59f8d7b7450 |
| hovercard-subject-tag | issue:213643213 |
| 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/8277/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b67029c918dd65dd7619ef67e7d2c9a42bb51ecc820b376a67cba512c3f262cf/matplotlib/matplotlib/issues/8277 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b67029c918dd65dd7619ef67e7d2c9a42bb51ecc820b376a67cba512c3f262cf/matplotlib/matplotlib/issues/8277 |
| og:image:alt | Bug report Bug summary matplotlib.collections.LineCollection does not support modifying cap style and join style. I found a similar problem description on stack exchange here, but no solution could... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | blatts |
| hostname | github.com |
| expected-hostname | github.com |
| None | e840f405b2718e8f2d55aafa9ff27dbce17e29d0c253011d05ea0fea3c78baff |
| 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 | e876f00c5723f6080b9d294e4958fd4d506e6faf |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width