Title: [Bug]: inset_locator is broken when used with subfigures · Issue #24589 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: inset_locator is broken when used with subfigures · Issue #24589 · matplotlib/matplotlib
X Title: [Bug]: inset_locator is broken when used with subfigures · Issue #24589 · matplotlib/matplotlib
Description: Bug summary When using inset_locator functions in subfigures, the plots are not placed correctly. Adapting this demo https://matplotlib.org/stable/gallery/axes_grid1/demo_colorbar_of_inset_axes.html to use subfigures shows incorrect plot...
Open Graph Description: Bug summary When using inset_locator functions in subfigures, the plots are not placed correctly. Adapting this demo https://matplotlib.org/stable/gallery/axes_grid1/demo_colorbar_of_inset_axes.htm...
X Description: Bug summary When using inset_locator functions in subfigures, the plots are not placed correctly. Adapting this demo https://matplotlib.org/stable/gallery/axes_grid1/demo_colorbar_of_inset_axes.htm...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/24589
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: inset_locator is broken when used with subfigures","articleBody":"### Bug summary\n\nWhen using inset_locator functions in subfigures, the plots are not placed correctly. Adapting this demo\r\nhttps://matplotlib.org/stable/gallery/axes_grid1/demo_colorbar_of_inset_axes.html\r\nto use subfigures shows incorrect plots.\n\n### Code for reproduction\n\n```python\nfrom matplotlib import cbook\r\nimport matplotlib.pyplot as plt\r\nfrom mpl_toolkits.axes_grid1.inset_locator import inset_axes, zoomed_inset_axes\r\n\r\n\r\nfig = plt.figure()\r\nfig1, fig2 = fig.subfigures(nrows=2, ncols=1, height_ratios=[1, 1], squeeze=True)\r\n\r\nax = fig1.subplots()\r\nax.set(aspect=1, xlim=(-15, 15), ylim=(-20, 5))\r\n\r\nZ = cbook.get_sample_data(\"axes_grid/bivariate_normal.npy\", np_load=True)\r\nextent = (-3, 4, -4, 3)\r\n\r\naxins = zoomed_inset_axes(ax, zoom=2, loc='upper left')\r\naxins.set(xticks=[], yticks=[])\r\nim = axins.imshow(Z, extent=extent, origin=\"lower\")\r\n\r\n# colorbar\r\ncax = inset_axes(axins,\r\n width=\"5%\", # width = 10% of parent_bbox width\r\n height=\"100%\", # height : 50%\r\n loc='lower left',\r\n bbox_to_anchor=(1.05, 0., 1, 1),\r\n bbox_transform=axins.transAxes,\r\n borderpad=0,\r\n )\r\nfig.colorbar(im, cax=cax)\r\n\r\nplt.show()\n```\n\n\n### Actual outcome\n\n\u003cimg width=\"414\" alt=\"image\" src=\"https://user-images.githubusercontent.com/1170234/205410117-9ed9619c-2368-42a8-bfbc-8909cfb9eba1.png\"\u003e\r\n\n\n### Expected outcome\n\nSomething more similar to https://matplotlib.org/stable/gallery/axes_grid1/demo_colorbar_of_inset_axes.html\n\n### Additional information\n\n_No response_\n\n### Operating system\n\nOS/X\n\n### Matplotlib Version\n\n3.6.1\n\n### Matplotlib Backend\n\nmodule://matplotlib_inline.backend_inline\n\n### Python version\n\n_No response_\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\npip","author":{"url":"https://github.com/amcpherson","@type":"Person","name":"amcpherson"},"datePublished":"2022-12-02T23:49:03.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/24589/matplotlib/issues/24589"}
| 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:d79f904c-e5a5-3efd-2c94-e14e514fa0d4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E62C:C92EC:FD9B90:152C9A4:6A529805 |
| html-safe-nonce | 8ad951ef8c9dc2003ff19711d0f3601ddc77531c7d69a59745ab0bf6b33bf4c4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNjJDOkM5MkVDOkZEOUI5MDoxNTJDOUE0OjZBNTI5ODA1IiwidmlzaXRvcl9pZCI6IjE2NDI5NDQxMTc3MTY3MTk2MjEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | cbd16014af374f09f5c30850d326df99e44e0b127066d78aaaf2dbaa3713b7ed |
| hovercard-subject-tag | issue:1473590414 |
| 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/24589/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6888156e7cbfbde0c1596be729d23e7fd50f2d3e7a954b8c64992ad70b282840/matplotlib/matplotlib/issues/24589 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6888156e7cbfbde0c1596be729d23e7fd50f2d3e7a954b8c64992ad70b282840/matplotlib/matplotlib/issues/24589 |
| og:image:alt | Bug summary When using inset_locator functions in subfigures, the plots are not placed correctly. Adapting this demo https://matplotlib.org/stable/gallery/axes_grid1/demo_colorbar_of_inset_axes.htm... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | amcpherson |
| 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