Skip to content

Inconsistent inset axes size when using transform='axes' with different projections #751

Closed as not planned

Description

@gepcel

Description

When creating a figure with two subplots using different projections (e.g., cart and cyl) and adding inset axes with identical relative bounding boxes (transform='axes'), the resulting inset axes have inconsistent physical sizes.

Since transform='axes' specifies the inset position and size as a fraction of the parent axes, the insets should visually occupy the same proportion of their respective parent axes, regardless of the parent's projection.

Example

fig,ax=pplt.subplots(ncols=2, nrows=1, proj=['cart', 'cyl'], share=False)
ax[0].format(xlim=(0,1),ylim=(0,1))
ax[1].format(lonlim=(0,1),latlim=(0,1),labels=True)
ax[0].inset([.7, .0, .3, .3], transform='axes')
ax[1].inset([.7, .0, .3, .3], transform='axes', proj='cyl')

Expected Behavior

Both inset axes should have the exact same relative size and shape within their respective parent axes, as they are defined by the same [left, bottom, width, height] parameters in axes coordinates.

Actual Behavior

The inset axes appear to have different physical sizes on the rendered figure.

Activity

  1. cvanelteren commented on Jul 8, 2026

    @cvanelteren
    Collaborator

    I think this is actually an issue with cartopy rather than with UltraPlot. Let me check.

  2. cvanelteren commented on Jul 8, 2026

    @cvanelteren
    Collaborator

    Yeah I checked, this is caused by Cartopy. You can see this by forcing square aspects. We are placing the axes exactly where it should be but cartopy is reshaping it to the size for the default range. You can see this by checking this:

    ix = ax[1].inset([.7, .0, .3, .3], transform='axes', proj='cyl')
    ix.format(lonlim=(0, 1), latlim=(0, 1)) # this would be square at the location
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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