Title: ENH: Allow axes to have child axes. · Issue #11005 · matplotlib/matplotlib · GitHub
Open Graph Title: ENH: Allow axes to have child axes. · Issue #11005 · matplotlib/matplotlib
X Title: ENH: Allow axes to have child axes. · Issue #11005 · matplotlib/matplotlib
Description: Suggestion This would subsume #10976: see #10961 #10960 for secondary axes requests. See #8952 for the poor state of documentation and confusing behaviour of axes_grid1.inset_axes. #10986, #10756 There are a few instances where it would ...
Open Graph Description: Suggestion This would subsume #10976: see #10961 #10960 for secondary axes requests. See #8952 for the poor state of documentation and confusing behaviour of axes_grid1.inset_axes. #10986, #10756 T...
X Description: Suggestion This would subsume #10976: see #10961 #10960 for secondary axes requests. See #8952 for the poor state of documentation and confusing behaviour of axes_grid1.inset_axes. #10986, #10756 T...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/11005
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ENH: Allow axes to have child axes.","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### Suggestion\r\n\r\nThis would subsume #10976: see #10961 #10960 for secondary axes requests. \r\n\r\nSee #8952 for the poor state of documentation and confusing behaviour of `axes_grid1.inset_axes`. #10986, #10756\r\n\r\nThere are a few instances where it would make sense for an axes to have an axes as a child artist:\r\n \r\n 1. an inset_axes with a subsection of the data, or some other information (ala https://github.com/matplotlib/matplotlib/blob/adaa8e59a8169ae294cddf5522d3cb9d6b8a6ab3/lib/mpl_toolkits/axes_grid1/inset_locator.py#L389-L390)\r\n2. a secondary scale (i.e a second x-scale at the top of the axes in a different unit). \r\n\r\nI'd propose we create an API for these. I would expect the legend API would be fine for inset axes, and would closely follow the one already in axes_grid1. An example would be:\r\n\r\n```python\r\n# inset from x=0.65 to 0.95, y=0.75 to 0.95\r\ninax = ax.inset_axes(location='upper_right', width=0.3, height=0.2, padding=0.05) \r\n# inset from x=0 to 0.25, y=0.3 to 0.7\r\ninax = ax.inset_axes(bbox_to_anchor=(0, 0.3, 0.25, 0.4))\r\n```\r\n\r\nSecondary axes would be basically an `inset_axes`, except with the appropriate spines turned off:\r\n\r\n```python\r\nsecx = ax.extra_spine_x(location='top', convert=(lambda x: 1/x))\r\nthirdx = ax.extra_spine_x(location=0.5, convert=(lambda x: 1/x))\r\n\r\nsecy = ax.extra_spine_y(location='right', convert=(lambda y: y**2))\r\n```\r\n\r\n#### Implementation\r\n\r\nI would like to have these be children of the parent axes simply for the reason that they are decorators, and should be included in the list of artists a) at draw time, and b) when the bbox for the parent axes is calculated for tools like constrained_layout and tight_layout. Also having them as children makes it possible to change the limits if the parent limits change, and avoids the messiness of twin axes, which have a peer-to-peer relationship. \r\n\r\n\r\n","author":{"url":"https://github.com/jklymak","@type":"Person","name":"jklymak"},"datePublished":"2018-04-09T04:33:15.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":11},"url":"https://github.com/11005/matplotlib/issues/11005"}
| 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:ff1bbb8b-8893-4a7a-990e-0d6361753aeb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B642:264800:EB502:12CD7C:6A52C064 |
| html-safe-nonce | 6fe51aba93db1623b60eba34e7e5b5ccbd0006406556a405473ef3c42a5c166c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNjQyOjI2NDgwMDpFQjUwMjoxMkNEN0M6NkE1MkMwNjQiLCJ2aXNpdG9yX2lkIjoiMzg2MjAxMzEzMjM5NTQyOTk4OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 941d43c8fca9a2cd774cfc87019706fa3278ce48ae3117da9bfb6d40f4ef1683 |
| hovercard-subject-tag | issue:312390052 |
| 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/11005/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9895c626685677b7f0f77306a732e6282d3d1f4741afe8d72f19c6a99079520b/matplotlib/matplotlib/issues/11005 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9895c626685677b7f0f77306a732e6282d3d1f4741afe8d72f19c6a99079520b/matplotlib/matplotlib/issues/11005 |
| og:image:alt | Suggestion This would subsume #10976: see #10961 #10960 for secondary axes requests. See #8952 for the poor state of documentation and confusing behaviour of axes_grid1.inset_axes. #10986, #10756 T... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jklymak |
| 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