Title: [MNT]: Use mpl.rcParams internally · Issue #23680 · matplotlib/matplotlib · GitHub
Open Graph Title: [MNT]: Use mpl.rcParams internally · Issue #23680 · matplotlib/matplotlib
X Title: [MNT]: Use mpl.rcParams internally · Issue #23680 · matplotlib/matplotlib
Description: Summary Originally mentioned in #16181 (comment) Don't import rcParams into matplotlib modules directly: # NO: from matplotlib import rcParams ... rcParams[...] This has the disadvantage that rcParams get into the module namespace and pe...
Open Graph Description: Summary Originally mentioned in #16181 (comment) Don't import rcParams into matplotlib modules directly: # NO: from matplotlib import rcParams ... rcParams[...] This has the disadvantage that rcPar...
X Description: Summary Originally mentioned in #16181 (comment) Don't import rcParams into matplotlib modules directly: # NO: from matplotlib import rcParams ... rcParams[...] This has the disadvantage that r...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/23680
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[MNT]: Use mpl.rcParams internally","articleBody":"### Summary\r\n\r\nOriginally mentioned in https://github.com/matplotlib/matplotlib/issues/16181#issue-548352957\r\n\r\nDon't import `rcParams` into matplotlib modules directly:\r\n\r\n```\r\n# NO:\r\nfrom matplotlib import rcParams\r\n...\r\nrcParams[...]\r\n```\r\nThis has the disadvantage that `rcParams` get into the module namespace and people easily start using that (e.g. `from matplotlib import cm; cm.rcParams`).\r\n\r\nInstead use\r\n```\r\n# YES:\r\nimport matplotlib as mpl\r\n...\r\nmpl.rcParams[...]\r\n```\r\nWhile in theory people could still access it via `mpl` (e.g. `cm.mpl.rcParams`), this is far more unlikely and good enough for us. - We also don't shield other module imports.\r\n\r\nNote: It's also ok to use `plt.rcParams` if you happen to have pyplot anyway and would have to import mpl. This is in particular true for examples. But most matplotlib modules should not depend on `pyplot`.\r\n\r\nThere are many places in the library that need fixing, so it's ok to do this step-by-step.\r\n\r\nRelated PRs:\r\n\r\n- #16406\r\n- #16525\r\n- #16780\r\n- #23676\r\n- #23678\r\n\r\n\r\n\r\n\r\n","author":{"url":"https://github.com/timhoffm","@type":"Person","name":"timhoffm"},"datePublished":"2022-08-19T15:13:26.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/23680/matplotlib/issues/23680"}
| 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:f8879fb4-cebd-f47c-9bc6-fbc51f46876a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ACF8:2D5E27:7403F8:9BC5E4:6A51D7FA |
| html-safe-nonce | b8831b12169ad0ee9dd2c56e59ba424331fce273092854c0faa57cb6ca83f764 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQ0Y4OjJENUUyNzo3NDAzRjg6OUJDNUU0OjZBNTFEN0ZBIiwidmlzaXRvcl9pZCI6IjcwNDUyNTc0MDk3MzI5MjU0MzQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | dec47cdbf45e4479a42c1c9235eda12f834a6b53a8691a404aded8c0f9ce5785 |
| hovercard-subject-tag | issue:1344572398 |
| 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/23680/issue_layout |
| twitter:image | https://opengraph.githubassets.com/599925a075705ae71102cb6c698450785a6ef77436cf3c761c11a6662870ed44/matplotlib/matplotlib/issues/23680 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/599925a075705ae71102cb6c698450785a6ef77436cf3c761c11a6662870ed44/matplotlib/matplotlib/issues/23680 |
| og:image:alt | Summary Originally mentioned in #16181 (comment) Don't import rcParams into matplotlib modules directly: # NO: from matplotlib import rcParams ... rcParams[...] This has the disadvantage that rcPar... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | timhoffm |
| 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