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]: pyplot.Figure.add_axes does not respect the transform argument #24225

Open
@suuuehgi

Description

Bug summary

pyplot.Figure.add_axes does not seem to respect the transform argument.

Edit: This might already exist for a while: #8986

Code for reproduction

from matplotlib import pyplot as plt
fig, axs = plt.subplots( nrows=2, sharex=True )
# left, bottom, width, height
fig.add_axes([.5, .5, .1, .1], transform=axs[1].transAxes)
fig.tight_layout()

Actual outcome

github

Expected outcome

github2

I found this workaround in the above-mentioned issue.

import matplotlib
box = matplotlib.transforms.Bbox.from_bounds(.5, .5, .1, .1)
fig.add_axes(fig.transFigure.inverted().transform_bbox( axs[1].transAxes.transform_bbox(box)))

Additional information

No response

Operating system

Arch

Matplotlib Version

3.6.1

Matplotlib Backend

module://matplotlib_inline.backend_inline

Python version

Python 3.10.7

Jupyter version

Jupyter Lab v. 3.4.5

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /