Title: path randomness is repetitive (sketch RNG seeded to 0 for each path anew) · Issue #13479 · matplotlib/matplotlib · GitHub
Open Graph Title: path randomness is repetitive (sketch RNG seeded to 0 for each path anew) · Issue #13479 · matplotlib/matplotlib
X Title: path randomness is repetitive (sketch RNG seeded to 0 for each path anew) · Issue #13479 · matplotlib/matplotlib
Description: Bug report Sketch transformation has identical pseudo-random output for identical inputs The sketch transformation (such as used in xkcd) produces exactly the same randomized result if the same path is plotted repeatedly. This is visible...
Open Graph Description: Bug report Sketch transformation has identical pseudo-random output for identical inputs The sketch transformation (such as used in xkcd) produces exactly the same randomized result if the same pat...
X Description: Bug report Sketch transformation has identical pseudo-random output for identical inputs The sketch transformation (such as used in xkcd) produces exactly the same randomized result if the same pat...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/13479
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"path randomness is repetitive (sketch RNG seeded to 0 for each path anew)","articleBody":"### Bug report\r\n\r\n**Sketch transformation has identical pseudo-random output for identical inputs**\r\n\r\nThe sketch transformation (such as used in xkcd) produces exactly the same randomized result if the same path is plotted repeatedly. This is visible especially in the legend, where the rectangle patch is repeated for each item. I exaggerated randomness and scale to make the effect better visible.\r\n\r\nAs far as I can see, the culprit is in the built-in RNG which gets re-seeded to 0 for each Sketch instantionation: https://github.com/matplotlib/matplotlib/blob/e02f2c5dca0bfd6a83cd0d41db31e48dea9fd14f/src/path_converters.h#L941.\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\nwith plt.xkcd(randomness=40,scale=1):\r\n import matplotlib\r\n from matplotlib import gridspec\r\n pat,txt=plt.pie([10,20,30,40],wedgeprops={'edgecolor':'black'})\r\n plt.legend(pat,['first','second','third','fourth'],loc='best')\r\n\r\n```\r\n**Actual outcome**\r\n\r\n\r\nzoom on the legend:\r\n\r\n\r\n\r\n**Expected outcome**\r\n\r\nShapes are distored randomly, e.g. each rectangle in the legend is different.\r\n\r\n**Matplotlib version**\r\n * Operating system: Ubuntu 18.04\r\n * Matplotlib version: 2.2.2\r\n * Matplotlib backend (`print(matplotlib.get_backend())`): TkAgg\r\n * Python version: 3.6.7\r\n * Jupyter version (if applicable): [none]\r\n * Other libraries: \r\n\r\ninstallation: default packaged matplotlib installation (python3-matplotlib).\r\n","author":{"url":"https://github.com/eudoxos","@type":"Person","name":"eudoxos"},"datePublished":"2019-02-21T12:05:28.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":17},"url":"https://github.com/13479/matplotlib/issues/13479"}
| 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:b5a6f184-178c-5a0c-22c4-0c239bafe73d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D368:10FEF0:159DEA1:1CD9C42:6A52AD4E |
| html-safe-nonce | c205b408d2cd6151e851af9dd17df1c6c23d92bafd24b2a8239a693372f8782c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMzY4OjEwRkVGMDoxNTlERUExOjFDRDlDNDI6NkE1MkFENEUiLCJ2aXNpdG9yX2lkIjoiNjA3NjQ0NzE1NTgwNzIzNTQwNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2d8e8276712a9e71e088a0975af7c51dbd2a817d283418f66cdb15b68f7ef387 |
| hovercard-subject-tag | issue:412891657 |
| 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/13479/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a88086b117c5cdcd5b97f95c7280effcf5a3a75c191e4db72be3ce28c58a6bd6/matplotlib/matplotlib/issues/13479 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a88086b117c5cdcd5b97f95c7280effcf5a3a75c191e4db72be3ce28c58a6bd6/matplotlib/matplotlib/issues/13479 |
| og:image:alt | Bug report Sketch transformation has identical pseudo-random output for identical inputs The sketch transformation (such as used in xkcd) produces exactly the same randomized result if the same pat... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | eudoxos |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width