Title: Axes creation seems to reuse an old one instead of creating a new one · Issue #9024 · matplotlib/matplotlib · GitHub
Open Graph Title: Axes creation seems to reuse an old one instead of creating a new one · Issue #9024 · matplotlib/matplotlib
X Title: Axes creation seems to reuse an old one instead of creating a new one · Issue #9024 · matplotlib/matplotlib
Description: Bug report Bug summary It appears that when plt.axes() is called, if the parameters are identical to a previous call, that old axes is reused instead of creating a new one. I don't know if this is by design or not but it makes the behavi...
Open Graph Description: Bug report Bug summary It appears that when plt.axes() is called, if the parameters are identical to a previous call, that old axes is reused instead of creating a new one. I don't know if this is ...
X Description: Bug report Bug summary It appears that when plt.axes() is called, if the parameters are identical to a previous call, that old axes is reused instead of creating a new one. I don't know if this...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/9024
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Axes creation seems to reuse an old one instead of creating a new one","articleBody":"\u003c!--To help us understand and resolve your issue, please fill out the form to the best of your ability.--\u003e\r\n\u003c!--You can feel free to delete the sections that do not apply.--\u003e\r\n\r\n### Bug report\r\n\r\n**Bug summary**\r\n\r\nIt appears that when plt.axes() is called, if the parameters are identical to a previous call, that old axes is reused instead of creating a new one. I don't know if this is by design or not but it makes the behavior very unexpected. \r\n\r\n\u003c!--A short 1-2 sentences that succinctly describes the bug--\u003e\r\n\r\n**Code for reproduction**\r\n\r\n\u003c!--A minimum code snippet required to reproduce the bug, also minimizing the number of dependencies required--\u003e\r\n\r\n```python\r\n\r\n%matplotlib notebook\r\n\r\nimport matplotlib.pyplot as plt\r\nfrom matplotlib.widgets import Button\r\nfrom mpl_toolkits.axes_grid1 import inset_locator\r\n\r\nfig = plt.figure()\r\nax = fig.add_subplot(111)\r\n\r\na1=plt.axes([0,0,1,1], facecolor='yellow')\r\npos1=inset_locator.InsetPosition(parent=ax,lbwh=[.5,.5,.04,.04])\r\na1.set_axes_locator(locator=pos1)\r\nb1=Button(a1,'1')\r\n\r\na2=plt.axes([0,0,1,1], facecolor='yellow') \r\n# the parameters above are identical to those of a1, resulting in this behaving \r\n# as if one says a2=a1\r\npos2=inset_locator.InsetPosition(parent=ax,lbwh=[.6,.5,.04,.04])\r\na2.set_axes_locator(locator=pos2)\r\nb2=Button(a2,'2')\r\n\r\na3=plt.axes([0,0,1,1], facecolor='orange')\r\n# the parameters above are different from previous axes() calls and therefore a new\r\n# axes is created \r\npos3=inset_locator.InsetPosition(parent=ax,lbwh=[.7,.5,.04,.04])\r\na3.set_axes_locator(locator=pos3)\r\nb3=Button(a3,'3')\r\n\r\n# The use of buttons is to illustrate a use case. But it is not necessary; the behavior is the \r\n# same if one comments out the three Button() calls\r\n\r\nplt.show()\r\n```\r\n\r\n**Actual outcome**\r\n\r\n\u003c!--The output produced by the above code, which may be a screenshot, console output, etc.--\u003e\r\n\r\nTwo buttons appear, one with \"1\" and \"2\" on top of each other and the other with \"3\" in it.\r\n\r\n\r\n**Expected outcome**\r\n\r\n\u003c!--A description of the expected outcome from the code snippet--\u003e\r\n\r\nThree buttons appear: \"1\", \"2\", and \"3\" horizontally.\r\n\r\n\u003c!--If this used to work in an earlier version of Matplotlib, please note the version it used to work on--\u003e\r\n\r\n**Matplotlib version**\r\n\u003c!--Please specify your platform and versions of the relevant libraries you are using:--\u003e\r\n * Operating System: Window 7\r\n * Matplotlib Version: 2.0.2\r\n * Python Version: 3.6.1 (Anaconda 4.4.0)\r\n * Jupyter Version: 5.0.0 (IPython 5.3.0)\r\n * Other Libraries: No\r\n\r\n\u003c!--Please tell us how you installed matplotlib and python e.g., from source, pip, conda--\u003e\r\n\u003c!--If you installed from conda, please specify which channel you used if not the default--\u003e\r\n\r\n","author":{"url":"https://github.com/omasoud","@type":"Person","name":"omasoud"},"datePublished":"2017-08-12T00:08:31.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":13},"url":"https://github.com/9024/matplotlib/issues/9024"}
| 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:dfb641e8-0fe4-ffa4-37f1-07d594da9449 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D3FE:28D644:61C621:83B007:6A526892 |
| html-safe-nonce | 9545658e94bf139a0eca8c31f52d4865bd6469bf53c8f2618273e90f14899745 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEM0ZFOjI4RDY0NDo2MUM2MjE6ODNCMDA3OjZBNTI2ODkyIiwidmlzaXRvcl9pZCI6IjkwMTE3NjQ2MzQ5NjE3MzM3NzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f80420159347631997bc9e773e2d72992f17e48dafefc604dd1eb6956065e069 |
| hovercard-subject-tag | issue:249774327 |
| 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/9024/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d79d10afeced8dc478b1f6b32711220f6100319b11b4757f8e6c29e8e783d1d7/matplotlib/matplotlib/issues/9024 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d79d10afeced8dc478b1f6b32711220f6100319b11b4757f8e6c29e8e783d1d7/matplotlib/matplotlib/issues/9024 |
| og:image:alt | Bug report Bug summary It appears that when plt.axes() is called, if the parameters are identical to a previous call, that old axes is reused instead of creating a new one. I don't know if this is ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | omasoud |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width