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]: Bbox transformed method produces unexpected results #27151

Open
@inferentialist

Description

@inferentialist

Bug summary

The current implementation seems to assume that the lower leftll, upper leftul, and lower rightlr corners are preserved under transformation. This need not be the case. For example, an affine transformation that simply switches coordinates produces a wrong result.

Code for reproduction

importnumpyasnpfrommatplotlib.transformsimportAffine2D,Bbox# Switch 'x' and 'y' coordinatesT=Affine2D(np.array([          [0,1,0],          [1,0,0],          [0,0,1]        ])      )# Unit vectorspts=np.array([  [1,0],  [0,1]])# Produce a Bbox from the unit vectorsbb=Bbox.null()bb.update_from_data_xy(pts)# Resultbb.transformed(T )

Actual outcome

In [84]: bb.transformed( T )Out[84]: Bbox([[0.0, 0.0], [0.0, 0.0]])

Expected outcome

bb.transformed( T ).height == 1.0bb.transformed( T ).width == 1.0

Additional information

The current implementation (v3.8.0) seems to assume that the lower leftll, upper leftul, and lower rightlr corners are preserved under transformation. A more general solution should probably transform each corner and fully recompute the bounding box.

Operating system

linux

Matplotlib Version

3.8.0

Matplotlib Backend

TkAgg

Python version

3.11.5

Jupyter version

No response

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp