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

How to easily set the location and size of a sub_axes? #8986

Closed
@gepcel

Description

@gepcel

The problem comes from me drawwing a map via cartopy. I want to add a little sub_axes on the lower_right corner of the main axes. But it seems hard to set the location and size of the sub_axes.

The first thing I tried wasfig.add_axes(). But it doesn't accepttransform args, while thedocument says it should. Without thetransform args, the location (left, bottom) and size (width, height) wasn't on the transform ofax.

importmatplotlib.pyplotaspltfig,ax=plt.subplots(1,1)ax2=fig.add_axes([0.8,0,0.2,0.2],transform=ax.transAxes,projection='rectilinear')

The second I tried wasinset_axes, which was very easy to use. But it doesn't acceptprojection args.

frommpl_toolkits.axes_grid.inset_locatorimportinset_axesimportmatplotlib.pyplotaspltfig,ax=plt.subplots(1,1)# The following line doesn't workax2=inset_axes(ax,width='20%',height='20%',axes_kwargs={'projection':'rectilinear'})# Doesn't work neither:ax2=inset_axes(ax,width='20%',height='20%',projection='rectilinear')

I may get what I want byax.get_position(), the set the position according it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp