Skip to content

[Bug]: get_path_collection_extents wrong when master_transform is not affine #26515

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
anntzer opened this issue Aug 13, 2023 · 0 comments
Open

Comments

@anntzer
Copy link
Contributor

anntzer commented Aug 13, 2023

Bug summary

All's in the title.

Code for reproduction

from matplotlib.path import *
from matplotlib.transforms import *
from matplotlib.scale import LogTransform

get_path_collection_extents(
    Affine2D().scale(2, 3),
    [Path([(1, 2), (3, 4)])], [], [(0, 0)], IdentityTransform())
get_path_collection_extents(
    blended_transform_factory(IdentityTransform(), LogTransform(10)) + Affine2D().scale(2, 3),
    [Path([(1, 2), (3, 4)])], [], [(0, 0)], IdentityTransform())

Actual outcome

Both expressions evaluate to Bbox([[2.0, 6.0], [6.0, 12.0]]).

Expected outcome

The second expression is different.

Additional information

This probably has the same underlying cause as #7975 (implicit conversion of the non-affine transform to its affine component only). (I tried to add a warning for the deprecation in #7975 and ran into this bug.)
get_path_collection_extents is called by Collection.get_datalim; it may be possible to construct a more explicit example where the autoscaling is wrong for a suitably-constructed Collection.

Operating system

macos

Matplotlib Version

3.8.0.dev1803+gbba391d1b6

Matplotlib Backend

any

Python version

3.11.3

Jupyter version

No response

Installation

git checkout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant