-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
inset_locator.inset_axes produces axes without extent and at incorrect position. #8952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Likely both, the |
I've spent a bit of time trying to understand where this behaviour is coming from. I've noted the following:
The following snippet illustrates the current behaviour on matplotlib 2.1.0, which may be useful to anyone trying to work around or fix it.
|
Wow, good catch @alcrene. 👍
The |
Closing since this is now fixed by #11060. |
The
mpl_toolkits.axes_grid1.inset_locator.inset_axes
is not working as expected when using thebbox_to_anchor
argument. Usinginset_axes(ax, width="70%", height="30%",bbox_to_anchor=(0.4,0.1), loc=3)
gives an inset axes without extention at an incorrect position. (This issue is raised in this stackoverflow post.)Complete example:
gives
and a warning
c:\winpython\winpython-64bit-2.7.10.3\python-2.7.10.amd64\lib\site-packages\matplotlib\axis.py:1035: UserWarning: Unable to find pixel distance along axis for interval padding of ticks; assuming no interval padding needed.
when being run with python 2.7, matplotlib 2.0.2. In the lower left corner of the image you see what I suppose are the ticks of the zero-sized axes. Since the documentation clearly states that
width
andheight
can be strings (and they actually can be ifbbox_to_anchor
is ommited) and since the defaultbbox_transform
isparent_axes.transAxes
, the above is clearly expected to work.Note that when explicitely supplying the
bbox_transform
we at least get the axes at the correct position,while width and height are further ignored.
Is this an error in the documentation or a bug in the matplotlib code?
The expected outcome of the above would be an inset axes with the lower left corner at (0.4,0.1) in axes coordinates and a width of 0.3 and a height of 0.7 (also in normalized axes units) as shown in the below image (which is produced by other means than
inset_axes
):The text was updated successfully, but these errors were encountered: