Title: UserWarning: "Trying to register the cmap '...' which already exists" is not very helpful. · Issue #19842 · matplotlib/matplotlib · GitHub
Open Graph Title: UserWarning: "Trying to register the cmap '...' which already exists" is not very helpful. · Issue #19842 · matplotlib/matplotlib
X Title: UserWarning: "Trying to register the cmap '...' which already exists" is not very helpful. · Issue #19842 · matplotlib/matplotlib
Description: Describe the issue Matplotlib 3.4 introduces a UserWarning with 1a9dacf when attempting to register a color map by the same name twice. So for a lame luser like myself, how am I to know if my colormap name has already been registered? Is...
Open Graph Description: Describe the issue Matplotlib 3.4 introduces a UserWarning with 1a9dacf when attempting to register a color map by the same name twice. So for a lame luser like myself, how am I to know if my color...
X Description: Describe the issue Matplotlib 3.4 introduces a UserWarning with 1a9dacf when attempting to register a color map by the same name twice. So for a lame luser like myself, how am I to know if my color...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/19842
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"UserWarning: \"Trying to register the cmap '...' which already exists\" is not very helpful.","articleBody":"### Describe the issue\r\n\r\nMatplotlib 3.4 introduces a UserWarning with 1a9dacff1cb when attempting to register a color map by the same name twice. So for a lame luser like myself, how am I to know if my colormap name has already been registered? Is there public API to check if a given cmap name exists? \r\n\r\n### Proposed fix\r\n\r\nPresently, I only see this option via \"private\" API to check this situation\r\n\r\n```python\r\nfrom matplotlib import cm\r\n\r\ndef cmap_exists(name):\r\n return name in cm.__builtin_cmaps\r\n```\r\n\r\nOtherwise, there would be this lame workaround\r\n\r\n```python\r\nfrom matplotlib import cm\r\n\r\ndef cmap_exists(name):\r\n try:\r\n cm.get_cmap(name)\r\n return True\r\n except ValueError:\r\n pass\r\n return False\r\n```\r\n\r\nHopefully I am not missing something obvious. If something exists, it would be nice to enhance the UserWarning by saying \"Trying to register the cmap {name!r} which already exists. Please first check presence of cmap by calling `cm.cmap_exists(name)`\"\r\n\r\nThank you!","author":{"url":"https://github.com/akrherz","@type":"Person","name":"akrherz"},"datePublished":"2021-04-01T18:05:28.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/19842/matplotlib/issues/19842"}
| 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:3daefe1b-3b42-2ab7-5fff-506c697ef6ce |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D372:17596C:25598A1:31D7858:6A520DAA |
| html-safe-nonce | 4ed9d671c146123ed6e57eff7883754a8c614c9e16655b1ee42920fb47af9dfe |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMzcyOjE3NTk2QzoyNTU5OEExOjMxRDc4NTg6NkE1MjBEQUEiLCJ2aXNpdG9yX2lkIjoiMTE2ODg3MjAwNTYxMDYzODc2MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a406379312abfddbfa2d31e1a77a7f034fd8b77af5d872ef8a54456d1fcb7efb |
| hovercard-subject-tag | issue:848677883 |
| 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/19842/issue_layout |
| twitter:image | https://opengraph.githubassets.com/339b9df2b948b26a5cc8019a7e99af94d48c54e936f9fd5d925289e8f55255a2/matplotlib/matplotlib/issues/19842 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/339b9df2b948b26a5cc8019a7e99af94d48c54e936f9fd5d925289e8f55255a2/matplotlib/matplotlib/issues/19842 |
| og:image:alt | Describe the issue Matplotlib 3.4 introduces a UserWarning with 1a9dacf when attempting to register a color map by the same name twice. So for a lame luser like myself, how am I to know if my color... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | akrherz |
| 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 | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width