Title: ENH: add to_grayscale() method to color maps by jakevdp · Pull Request #3589 · matplotlib/matplotlib · GitHub
Open Graph Title: ENH: add to_grayscale() method to color maps by jakevdp · Pull Request #3589 · matplotlib/matplotlib
X Title: ENH: add to_grayscale() method to color maps by jakevdp · Pull Request #3589 · matplotlib/matplotlib
Description: This PR adds a method to the Colormap base class which computes and returns a grayscale version of the map. This helps to quickly preview how various colormaps will appear when printed in grayscale. This uses the same formula as photoshop's grayscale conversion; see http://alienryderflex.com/hsp.html for details. As an example of the usage, we can quickly demonstrate one reason why everybody loves to rag on jet: plt.figure(figsize=(8, 3)) im = np.random.rand(10, 10) plt.subplot(121) plt.imshow(im, cmap=plt.cm.jet) plt.colorbar() plt.subplot(122) plt.imshow(im, cmap=plt.cm.jet.to_grayscale()) plt.colorbar() I'm open to any suggestions or comments! I'm not sure if there are any complications with corner cases that I might be overlooking...
Open Graph Description: This PR adds a method to the Colormap base class which computes and returns a grayscale version of the map. This helps to quickly preview how various colormaps will appear when printed in grayscale...
X Description: This PR adds a method to the Colormap base class which computes and returns a grayscale version of the map. This helps to quickly preview how various colormaps will appear when printed in grayscale...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/3589
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:4d79d75f-0810-2876-5409-9ce85e185ee8 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | CC68:2BA57F:1DDF2CE:2806BCC:6A545FA8 |
| html-safe-nonce | b52b299d63f29df2ed955674326ab51c0da5a1d522eb0981642f293798293079 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQzY4OjJCQTU3RjoxRERGMkNFOjI4MDZCQ0M6NkE1NDVGQTgiLCJ2aXNpdG9yX2lkIjoiNzU0Mjc4MzE0NDI0MTY4NDM5MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 1e7f761304901cf45812ba8748b137c425d39f826e41971085aa5b495a056b66 |
| hovercard-subject-tag | pull_request:21910226 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/matplotlib/matplotlib/pull/3589/files |
| twitter:image | https://avatars.githubusercontent.com/u/781659?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/781659?s=400&v=4 |
| og:image:alt | This PR adds a method to the Colormap base class which computes and returns a grayscale version of the map. This helps to quickly preview how various colormaps will appear when printed in grayscale... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 6d28624802c2f7d9500239dd6870ed7031b7353b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width