Title: CN colors look up the global prop_cycle at draw time rather than the axes' one. · Issue #9842 · matplotlib/matplotlib · GitHub
Open Graph Title: CN colors look up the global prop_cycle at draw time rather than the axes' one. · Issue #9842 · matplotlib/matplotlib
X Title: CN colors look up the global prop_cycle at draw time rather than the axes' one. · Issue #9842 · matplotlib/matplotlib
Description: Bug report Bug summary http://matplotlib.org/devdocs/tutorials/colors/colors.html states that a “CN” color spec, i.e. 'C' followed by a single digit, which is an index into the default property cycle (matplotlib.rcParams['axes.prop_cycle...
Open Graph Description: Bug report Bug summary http://matplotlib.org/devdocs/tutorials/colors/colors.html states that a “CN” color spec, i.e. 'C' followed by a single digit, which is an index into the default property cyc...
X Description: Bug report Bug summary http://matplotlib.org/devdocs/tutorials/colors/colors.html states that a “CN” color spec, i.e. 'C' followed by a single digit, which is an index into the default prop...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/9842
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"CN colors look up the global prop_cycle at draw time rather than the axes' one.","articleBody":"### Bug report\r\n\r\n**Bug summary**\r\n\r\nhttp://matplotlib.org/devdocs/tutorials/colors/colors.html states that\r\n\u003e a “CN” color spec, i.e. 'C' followed by a single digit, which is an index into the default property cycle (matplotlib.rcParams['axes.prop_cycle']); the indexing occurs at artist creation time and defaults to black if the cycle does not include color.\r\n\r\nIn particular, this implies that the lookup is *not* performed on the *Axes*' prop_cycle (but the global one), which is the actual behavior, may be a bit strange but I guess is OK.\r\nOn the other hand, the look up definitely occurs at draw time and not at artist creation time:\r\n\r\n**Code for reproduction**\r\n\r\n\u003c!--A minimum code snippet required to reproduce the bug, also minimizing the number of dependencies required--\u003e\r\n\r\n```python\r\nfrom pylab import *\r\n\r\ngca().set_axis_off()\r\nl, = plt.plot([1, 2], c=\"C0\")\r\nrcParams[\"axes.prop_cycle\"] = cycler(color=[\"r\", \"g\", \"b\"])\r\nprint(l.get_color())\r\nshow()\r\n```\r\n\r\n**Actual outcome**\r\n\r\noutputs 'C0' and a *red* line, not a tab:blue one.\r\n\r\n**Expected outcome**\r\n\r\nWe need to discuss whether the doc is wrong or the behavior is wrong...\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 * Operating system:\r\n * Matplotlib version: master (there was some refactoring in #6382 but looking at the diff it is clear that the current behavior was already present earlier).\r\n * Matplotlib backend (`print(matplotlib.get_backend())`):\r\n * Python version:\r\n * Jupyter version (if applicable):\r\n * Other libraries: \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","author":{"url":"https://github.com/anntzer","@type":"Person","name":"anntzer"},"datePublished":"2017-11-23T21:51:34.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/9842/matplotlib/issues/9842"}
| 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:ca0c2941-5c68-e334-7528-e3040ed8829c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A096:29DE49:18FFD51:21042C2:6A52C49B |
| html-safe-nonce | 49785ee1530c68423c3733745fa50f9513cd59d0be53a634fe73a53e19431890 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMDk2OjI5REU0OToxOEZGRDUxOjIxMDQyQzI6NkE1MkM0OUIiLCJ2aXNpdG9yX2lkIjoiODgzNDgzOTg5NTM1OTAxNDA0MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 63097693156ba8d6c99a22508f9a34c20ea5672504a033722fc62a2cec78b71f |
| hovercard-subject-tag | issue:276476524 |
| 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/9842/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2dc9244df05ce1190662c234919267ff9bfebd2b2338e9db0dfe735cce15ed19/matplotlib/matplotlib/issues/9842 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2dc9244df05ce1190662c234919267ff9bfebd2b2338e9db0dfe735cce15ed19/matplotlib/matplotlib/issues/9842 |
| og:image:alt | Bug report Bug summary http://matplotlib.org/devdocs/tutorials/colors/colors.html states that a “CN” color spec, i.e. 'C' followed by a single digit, which is an index into the default property cyc... |
| 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 | 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