Title: [Doc]: `subplot` behavior is not same as the doc reads in 3.10(stable) · Issue #29447 · matplotlib/matplotlib · GitHub
Open Graph Title: [Doc]: `subplot` behavior is not same as the doc reads in 3.10(stable) · Issue #29447 · matplotlib/matplotlib
X Title: [Doc]: `subplot` behavior is not same as the doc reads in 3.10(stable) · Issue #29447 · matplotlib/matplotlib
Description: Documentation Link https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.subplot.html Problem In the given doc link for version 3.10(stable), it reads Creating a new Axes will delete any preexisting Axes that overlaps with it beyon...
Open Graph Description: Documentation Link https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.subplot.html Problem In the given doc link for version 3.10(stable), it reads Creating a new Axes will delete any pree...
X Description: Documentation Link https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.subplot.html Problem In the given doc link for version 3.10(stable), it reads Creating a new Axes will delete any pree...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/29447
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Doc]: `subplot` behavior is not same as the doc reads in 3.10(stable)","articleBody":"### Documentation Link\n\nhttps://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.subplot.html\n\n### Problem\n\nIn the given [doc link](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.subplot.html) for version 3.10(stable), it reads\r\n\u003e Creating a new Axes will delete any preexisting Axes that overlaps with it beyond sharing a boundary: \r\n\r\nThe code is as below\r\n```\r\nimport matplotlib.pyplot as plt\r\n# plot a line, implicitly creating a subplot(111)\r\nplt.plot([1, 2, 3])\r\n# now create a subplot which represents the top plot of a grid\r\n# with 2 rows and 1 column. Since this subplot will overlap the\r\n# first, the plot (and its Axes) previously created, will be removed\r\nplt.subplot(211)\r\n```\r\n\r\nI tried to run the code in colab. It turns out that `subplot` doesn't remove previous plotting any more. \r\n\r\n\r\n\u003cimg width=\"756\" alt=\"image\" src=\"https://github.com/user-attachments/assets/165028c4-1dcb-4f7a-8fb6-be8466f25336\" /\u003e\r\n\r\n\r\n\n\n### Suggested improvement\n\nI recall the `subplot` behavior does remove previous plotting. Perhaps some code change alter the behavior. The current behavior is good.\r\n\r\nI suppose the doc should be updated to match the actual behavior. ","author":{"url":"https://github.com/mocheng","@type":"Person","name":"mocheng"},"datePublished":"2025-01-10T03:00:48.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/29447/matplotlib/issues/29447"}
| 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:639f5957-ef15-3b75-3da6-f00735caa024 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E74A:15465B:49F60:5F400:6A525394 |
| html-safe-nonce | 2f99657ce995e806aa62e442d2aa303c956bb6adf0d5fc57103dcc5a859a2a6f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNzRBOjE1NDY1Qjo0OUY2MDo1RjQwMDo2QTUyNTM5NCIsInZpc2l0b3JfaWQiOiIzMDY2MTQzODE2ODYyMDI4NjkyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 23f780adc37337cc14c2fe0e1c516f9290c5fdb952763fb1fde90a066c2770a0 |
| hovercard-subject-tag | issue:2779166854 |
| 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/29447/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1597b9ff9c2076e0ba018812f722a2fe12ca8f31cfdd5c1e3a6628412671d311/matplotlib/matplotlib/issues/29447 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1597b9ff9c2076e0ba018812f722a2fe12ca8f31cfdd5c1e3a6628412671d311/matplotlib/matplotlib/issues/29447 |
| og:image:alt | Documentation Link https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.subplot.html Problem In the given doc link for version 3.10(stable), it reads Creating a new Axes will delete any pree... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mocheng |
| 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