Title: use plt.subplots() in examples as much as possible by ivanov · Pull Request #1462 · matplotlib/matplotlib · GitHub
Open Graph Title: use plt.subplots() in examples as much as possible by ivanov · Pull Request #1462 · matplotlib/matplotlib
X Title: use plt.subplots() in examples as much as possible by ivanov · Pull Request #1462 · matplotlib/matplotlib
Description: This is a docs-only update - but I think it'll be worthwhile to start to give a more sensible way of creating figures and axes in one call for our the folks who'll be looking at matplotlib with fresh eyes after the 1.2 release. But I totally understand if folks feel this is too big of a pill to swallow this late in the game. At the recent LBL Software Carpentry Workshop, it was pointed out that there's an inconsistency within our documentation for how to create new figures with subplots. Indeed, most examples were using the old way, something like: fig = plt.figure() ax = plt.subplot(111) # or plt.add_subplot(111) This patch changes a whole bunch of instances like the above to: fig, ax = plt.subplots() We should strive to have a minimal amount of constants in our code, especially unusual ones like 111, which only make sense to Matlab refugees. I have left unchanged examples which were using axes keywords passed to subplot() and add_subplot(), since those end up transforming things like: figure() subplot(111, axisbg='w') to plt.subplots(subplot_kw=dict(axisbg='w')) which isn't necessarily better. I also did not touch most of the user_interfaces examples, since those did not involve using plt, but instead explicitly imported Figure, and used the OO approach on Figure instances. Also updated instaces where the old "import pylab as p" convention was used to use our standard "import matplotlib.pyplot as plt" I have also updated some, but not all uses of subplot(121) etc, but I'm a bit exhausted after doing all of these.
Open Graph Description: This is a docs-only update - but I think it'll be worthwhile to start to give a more sensible way of creating figures and axes in one call for our the folks who'll be looking at matplotlib ...
X Description: This is a docs-only update - but I think it'll be worthwhile to start to give a more sensible way of creating figures and axes in one call for our the folks who'll be looking at mat...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/1462
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:92ca68ac-fa55-de08-158f-94efdb15f579 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8D18:164416:9B5AB:CEC15:6A52BDE9 |
| html-safe-nonce | 66013f2fa42ff6c1499e9275aea54026ee45e4916bb288818220856f59a60d04 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RDE4OjE2NDQxNjo5QjVBQjpDRUMxNTo2QTUyQkRFOSIsInZpc2l0b3JfaWQiOiI4NDE1NjI1MzYwNDE1MzA5Mjg5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 37da2eded5d0056336297c0593a43a25307bf080391007b0706f59f916fd5bf6 |
| hovercard-subject-tag | pull_request:2925705 |
| 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/1462/files |
| twitter:image | https://avatars.githubusercontent.com/u/118211?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/118211?s=400&v=4 |
| og:image:alt | This is a docs-only update - but I think it'll be worthwhile to start to give a more sensible way of creating figures and axes in one call for our the folks who'll be looking at matplotlib ... |
| 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 full-width |
| disable-turbo | true |
| 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