Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Closed
Labels
Milestone
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 plots.
Code for reproduction
frommatplotlibimportcbookimportmatplotlib.pyplotaspltfrommpl_toolkits.axes_grid1.inset_locatorimportinset_axes,zoomed_inset_axesfig=plt.figure()fig1,fig2=fig.subfigures(nrows=2,ncols=1,height_ratios=[1,1],squeeze=True)ax=fig1.subplots()ax.set(aspect=1,xlim=(-15,15),ylim=(-20,5))Z=cbook.get_sample_data("axes_grid/bivariate_normal.npy",np_load=True)extent= (-3,4,-4,3)axins=zoomed_inset_axes(ax,zoom=2,loc='upper left')axins.set(xticks=[],yticks=[])im=axins.imshow(Z,extent=extent,origin="lower")# colorbarcax=inset_axes(axins,width="5%",# width = 10% of parent_bbox widthheight="100%",# height : 50%loc='lower left',bbox_to_anchor=(1.05,0.,1,1),bbox_transform=axins.transAxes,borderpad=0, )fig.colorbar(im,cax=cax)plt.show()
Actual outcome
Expected outcome
Something more similar tohttps://matplotlib.org/stable/gallery/axes_grid1/demo_colorbar_of_inset_axes.html
Additional information
No response
Operating system
OS/X
Matplotlib Version
3.6.1
Matplotlib Backend
module://matplotlib_inline.backend_inline
Python version
No response
Jupyter version
No response
Installation
pip
