Title: Line2D dash pattern getter · Issue #17316 · matplotlib/matplotlib · GitHub
Open Graph Title: Line2D dash pattern getter · Issue #17316 · matplotlib/matplotlib
X Title: Line2D dash pattern getter · Issue #17316 · matplotlib/matplotlib
Description: Bug report Bug summary For lines.Line2D, there exists line.get_linestyle() which returns a short string representation of one of the four preconfigured line styles ("-"/"--"/":"/"-."). For the "dashed" ("--") style, which is returned whe...
Open Graph Description: Bug report Bug summary For lines.Line2D, there exists line.get_linestyle() which returns a short string representation of one of the four preconfigured line styles ("-"/"--"/":"/"-."). For the "das...
X Description: Bug report Bug summary For lines.Line2D, there exists line.get_linestyle() which returns a short string representation of one of the four preconfigured line styles ("-"/"--"/&qu...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/17316
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Line2D dash pattern getter","articleBody":"### Bug report\r\n\r\n**Bug summary**\r\n\r\nFor ``lines.Line2D``, there exists ``line.get_linestyle()`` which returns a short string representation of one of the four preconfigured line styles (``\"-\"/\"--\"/\":\"/\"-.\"``). For the \"dashed\" (\"--\") style, which is returned wherever the linestyle input is a tuple (or ``dashes`` kwarg was used or ``set_dashes`` was called with tuple input), the exact dash pattern is not returned. There's no ``line.get_dashes()``.\r\n\r\nOn the contrary, ``collections.LineCollection([], linestyle=style).get_linestyle()`` returns the (scaled) dash pattern and not the preconfigured linestyle, which is more general and helpful. ``collection.get_dashes()`` is an alias for ``get_linestyle()``.\r\n\r\nIs it possible to add a getter for the (unscaled) original dash pattern of a line2d instance? \r\n\r\n**Code for reproduction**\r\n\r\n\u003c!--A minimum code snippet required to reproduce the bug.\r\nPlease make sure to minimize the number of dependencies required, and provide\r\nany necessary plotted data.\r\nAvoid using threads, as Matplotlib is (explicitly) not thread-safe.--\u003e\r\n\r\n```python\r\n#linestyle input to line2d can be queried but dash pattern is not exposed\r\nfrom matplotlib import lines\r\nline = lines.Line2D([],[],linestyle=(0,(2,2)))\r\nline.get_linestyle() # \"--\"\r\n#similar dashing input to lineCollection\r\nfrom matplotlib import collections\r\ncollection = collections.LineCollection([], linestyle=(0,(2,2)))\r\ncollection.get_linestyle() # [(0.0, [3.0, 3.0])]\r\n```\r\n\r\n**Actual outcome**\r\n\r\n\u003c!--The output produced by the above code, which may be a screenshot, console output, etc.--\u003e\r\n\r\n```\r\n'--'\r\n[(0.0, [3.0, 3.0])]\r\n```\r\n\r\n**Expected outcome**\r\n\r\n\u003c!--A description of the expected outcome from the code snippet--\u003e\r\n\u003c!--If this used to work in an earlier version of Matplotlib, please note the version it used to work on--\u003e\r\n\r\n**Matplotlib version**\r\n\u003c!--Please specify your platform and versions of the relevant libraries you are using:--\u003e\r\n * Matplotlib version: 3.2.1\r\n\r\n\r\nMany thanks for considering this!\r\n","author":{"url":"https://github.com/MaozGelbart","@type":"Person","name":"MaozGelbart"},"datePublished":"2020-05-03T19:41:31.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/17316/matplotlib/issues/17316"}
| 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:5ef013fe-399c-5bdf-bbaa-d4dd9a564d83 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9AF8:3C8683:2F49720:422D0A9:6A4F7330 |
| html-safe-nonce | 52f6f5565d9725687d03766561b49277ddd5b9d53ffee44d23335d7e18bb49fe |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QUY4OjNDODY4MzoyRjQ5NzIwOjQyMkQwQTk6NkE0RjczMzAiLCJ2aXNpdG9yX2lkIjoiMzMwMTc1NzMzODk0NDIzODM4NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e54e84ec1ef34ec5d3f221d7808ad6519c90ec92899f47e48d785b0322231419 |
| hovercard-subject-tag | issue:611490583 |
| 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/17316/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2b8d1273eae40304853e963a221941bb9c98beceed6cda4d622a5ec390aba6b5/matplotlib/matplotlib/issues/17316 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2b8d1273eae40304853e963a221941bb9c98beceed6cda4d622a5ec390aba6b5/matplotlib/matplotlib/issues/17316 |
| og:image:alt | Bug report Bug summary For lines.Line2D, there exists line.get_linestyle() which returns a short string representation of one of the four preconfigured line styles ("-"/"--"/":"/"-."). For the "das... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | MaozGelbart |
| hostname | github.com |
| expected-hostname | github.com |
| None | b92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9 |
| 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 | 4b249b445842943ed31549e027f57a8ade9881ed |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width