{"action":"created","issue":{"url":"https://api.github.com/repos/matplotlib/matplotlib/issues/11026","repository_url":"https://api.github.com/repos/matplotlib/matplotlib","labels_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/11026/labels{/name}","comments_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/11026/comments","events_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/11026/events","html_url":"https://github.com/matplotlib/matplotlib/pull/11026","id":313175654,"number":11026,"title":"ENH add an inset_axes to the axes class","user":{"login":"jklymak","id":1562854,"avatar_url":"https://avatars0.githubusercontent.com/u/1562854?v=4","gravatar_id":"","url":"https://api.github.com/users/jklymak","html_url":"https://github.com/jklymak","followers_url":"https://api.github.com/users/jklymak/followers","following_url":"https://api.github.com/users/jklymak/following{/other_user}","gists_url":"https://api.github.com/users/jklymak/gists{/gist_id}","starred_url":"https://api.github.com/users/jklymak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jklymak/subscriptions","organizations_url":"https://api.github.com/users/jklymak/orgs","repos_url":"https://api.github.com/users/jklymak/repos","events_url":"https://api.github.com/users/jklymak/events{/privacy}","received_events_url":"https://api.github.com/users/jklymak/received_events","type":"User","site_admin":false},"labels":[{"id":84780976,"url":"https://api.github.com/repos/matplotlib/matplotlib/labels/Needs%20review","name":"Needs review","color":"009800","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/matplotlib/matplotlib/milestones/23","html_url":"https://github.com/matplotlib/matplotlib/milestone/23","labels_url":"https://api.github.com/repos/matplotlib/matplotlib/milestones/23/labels","id":1542657,"number":23,"title":"v3.0","description":"Big ticket items:\r\n\r\n - drop support for python 2","creator":{"login":"tacaswell","id":199813,"avatar_url":"https://avatars3.githubusercontent.com/u/199813?v=4","gravatar_id":"","url":"https://api.github.com/users/tacaswell","html_url":"https://github.com/tacaswell","followers_url":"https://api.github.com/users/tacaswell/followers","following_url":"https://api.github.com/users/tacaswell/following{/other_user}","gists_url":"https://api.github.com/users/tacaswell/gists{/gist_id}","starred_url":"https://api.github.com/users/tacaswell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tacaswell/subscriptions","organizations_url":"https://api.github.com/users/tacaswell/orgs","repos_url":"https://api.github.com/users/tacaswell/repos","events_url":"https://api.github.com/users/tacaswell/events{/privacy}","received_events_url":"https://api.github.com/users/tacaswell/received_events","type":"User","site_admin":false},"open_issues":229,"closed_issues":320,"state":"open","created_at":"2016-01-25T21:06:49Z","updated_at":"2018-05-27T08:36:23Z","due_on":"2018-07-01T07:00:00Z","closed_at":null},"comments":26,"created_at":"2018-04-11T05:11:20Z","updated_at":"2018-05-27T15:41:00Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/11026","html_url":"https://github.com/matplotlib/matplotlib/pull/11026","diff_url":"https://github.com/matplotlib/matplotlib/pull/11026.diff","patch_url":"https://github.com/matplotlib/matplotlib/pull/11026.patch"},"body":"## PR Summary\r\n\r\nProof of concept for `ax.inset_axes`.  Pretty straight forward, but note that the `transData` one moves under zoom and pan.  \r\n\r\nNote that I chose not to go with the `bbox_to_anchor`, and `loc` approach.  I understand that stuff, but it seems needlessly complicated.  Maybe as a refinement.  \r\n\r\n```python \r\nimport matplotlib.pyplot as plt\r\n\r\nfig, ax = plt.subplots()\r\nax.plot(range(10))\r\naxin1 = ax.inset_axes_rect([0.8, 0.1, 0.15, 0.15])\r\naxin2 = ax.inset_axes_rect([5, 7, 2.3, 2.3], transform=ax.transData)\r\nplt.show()\r\n\r\n```\r\n![figure_1](https://user-images.githubusercontent.com/1562854/38630101-c7d5def6-3d6a-11e8-9c76-4e4fac87bbbe.png)\r\n\r\n\r\nGetting closer:  This is a duplication of https://matplotlib.org/gallery/axes_grid1/inset_locator_demo2.html#sphx-glr-gallery-axes-grid1-inset-locator-demo2-py\r\n\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\n\r\nimport numpy as np\r\n\r\ndef get_demo_image():\r\n    from matplotlib.cbook import get_sample_data\r\n    import numpy as np\r\n    f = get_sample_data(\"axes_grid/bivariate_normal.npy\", asfileobj=False)\r\n    z = np.load(f)\r\n    # z is a numpy array of 15x15\r\n    return z, (-3, 4, -4, 3)\r\n\r\nfig, ax = plt.subplots(figsize=[5, 4], constrained_layout=True)\r\nZ, extent = get_demo_image()\r\nZ2 = np.zeros([150, 150], dtype=\"d\")\r\nny, nx = Z.shape\r\nZ2[30:30 + ny, 30:30 + nx] = Z\r\n\r\n# extent = [-3, 4, -4, 3]\r\nax.imshow(Z2, extent=extent, interpolation=\"nearest\",\r\n          origin=\"lower\")\r\n\r\naxins = ax.inset_axes_rect([0.5, 0.5, 0.47, 0.47])\r\naxins.imshow(Z2, extent=extent, interpolation=\"nearest\",\r\n          origin=\"lower\")\r\n# sub region of the original image\r\nx1, x2, y1, y2 = -1.5, -0.9, -2.5, -1.9\r\naxins.set_xlim(x1, x2)\r\naxins.set_ylim(y1, y2)\r\naxins.set_xticklabels('')\r\naxins.set_yticklabels('')\r\n\r\nax.zoom_inset_indicator(axins)\r\nfig.canvas.draw()\r\nplt.show()\r\n```\r\n\r\n![figure_1](https://user-images.githubusercontent.com/1562854/38790106-ab80420a-40f3-11e8-81ba-e2fb60825460.png)\r\n\r\nEDIT: methods renamed `inset_axes_rect` to allow other APIs in the future.\r\n\r\n\r\n## PR Checklist\r\n\r\n- [ ] Has Pytest style unit tests\r\n- [ ] Code is PEP 8 compliant\r\n- [ ] New features are documented, with examples if plot related\r\n- [ ] Documentation is sphinx and numpydoc compliant\r\n- [ ] Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)\r\n- [ ] Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way\r\n\r\n<!--\r\nThank you so much for your PR!  To help us review your contribution, please\r\nconsider the following points:\r\n\r\n- A development guide is available at https://matplotlib.org/devdocs/devel/index.html.\r\n\r\n- Help with git and github is available at\r\n  https://matplotlib.org/devel/gitwash/development_workflow.html.\r\n\r\n- Do not create the PR out of master, but out of a separate branch.\r\n\r\n- The PR title should summarize the changes, for example \"Raise ValueError on\r\n  non-numeric input to set_xlim\".  Avoid non-descriptive titles such as\r\n  \"Addresses issue #8576\".\r\n\r\n- The summary should provide at least 1-2 sentences describing the pull request\r\n  in detail (Why is this change required?  What problem does it solve?) and\r\n  link to any relevant issues.\r\n\r\n- If you are contributing fixes to docstrings, please pay attention to\r\n  http://matplotlib.org/devel/documenting_mpl.html#formatting.  In particular,\r\n  note the difference between using single backquotes, double backquotes, and\r\n  asterisks in the markup.\r\n\r\nWe understand that PRs can sometimes be overwhelming, especially as the\r\nreviews start coming in.  Please let us know if the reviews are unclear or\r\nthe recommended next step seems overly demanding, if you would like help in\r\naddressing a reviewer's comments, or if you have been waiting too long to hear\r\nback on your PR.\r\n-->"},"comment":{"url":"https://api.github.com/repos/matplotlib/matplotlib/issues/comments/392340697","html_url":"https://github.com/matplotlib/matplotlib/pull/11026#issuecomment-392340697","issue_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/11026","id":392340697,"user":{"login":"jklymak","id":1562854,"avatar_url":"https://avatars0.githubusercontent.com/u/1562854?v=4","gravatar_id":"","url":"https://api.github.com/users/jklymak","html_url":"https://github.com/jklymak","followers_url":"https://api.github.com/users/jklymak/followers","following_url":"https://api.github.com/users/jklymak/following{/other_user}","gists_url":"https://api.github.com/users/jklymak/gists{/gist_id}","starred_url":"https://api.github.com/users/jklymak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jklymak/subscriptions","organizations_url":"https://api.github.com/users/jklymak/orgs","repos_url":"https://api.github.com/users/jklymak/repos","events_url":"https://api.github.com/users/jklymak/events{/privacy}","received_events_url":"https://api.github.com/users/jklymak/received_events","type":"User","site_admin":false},"created_at":"2018-05-27T15:41:00Z","updated_at":"2018-05-27T15:41:00Z","author_association":"CONTRIBUTOR","body":"@timhoffm Thanks a lot for the review.  I think I hit most of your specifics.  In response to your comments: \r\n\r\n- we could add a note about the new fcns being experimental.  \r\n- I see what you are saying about verbs in the method names, but looking at the code base, we don't do that very often.  ie. we do `ax.text`, `ax.arrow`, not `ax.add_text` and `ax.add_arrow`.  I don't wildly object to the verbosity but am not convinced its needed either, unless we think that other verbs acting on the same object are planned.  \r\n- the `add_child_axes` is needed for constrained layout and any other layout engine than needs to know how to calculate the parent bbox.  Moving this from `axes_grid1` has nothing to do with CL.  It is because its a features users often want, and it is a bit strange to point them to a toolbox.  Further the toolbox is somewhat poorly maintained and documented and the code a bit labyrinthian.  The hope here is to make these methods available with less user and maintainer pain.  "}}
{"actor":{"display_login":"jklymak"}}