Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Bug]: inset_locator is broken when used with subfigures #24589

Closed
Labels
Difficulty: Easyhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesGood first issueOpen a pull request against these issues if there are no active ones!status: has patchpatch suggested, PR still neededtopic: mpl_toolkit
Milestone
@amcpherson

Description

@amcpherson

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

image

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Difficulty: Easyhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesGood first issueOpen a pull request against these issues if there are no active ones!status: has patchpatch suggested, PR still neededtopic: mpl_toolkit

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp