-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: Regression in animation from #22175 #22921
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
Milestone
Comments
Okay the minimal example wasn't so bad, updated top comment. |
I can confirm it started failing in f93a0fc. |
I think this ultimately stems from removing index 49485bd900..0a62cd49e4 100644
--- a/lib/matplotlib/collections.py
+++ b/lib/matplotlib/collections.py
@@ -195,8 +195,9 @@ class Collection(artist.Artist, cm.ScalarMappable):
# default to zeros
self._offsets = np.zeros((1, 2))
+ self._has_offsets = offsets is not None
- if offsets is not None:
+ if self._has_offsets:
offsets = np.asanyarray(offsets, float)
# Broadcast (2,) -> (1, 2) but nothing else.
if offsets.shape == (2,):
@@ -290,18 +291,19 @@ class Collection(artist.Artist, cm.ScalarMappable):
offset_trf.transform_non_affine(offsets),
offset_trf.get_affine().frozen())
- # this is for collections that have their paths (shapes)
- # in physical, axes-relative, or figure-relative units
- # (i.e. like scatter). We can't uniquely set limits based on
- # those shapes, so we just set the limits based on their
- # location.
- offsets = (offset_trf - transData).transform(offsets)
- # note A-B means A B^{-1}
- offsets = np.ma.masked_invalid(offsets)
- if not offsets.mask.all():
- bbox = transforms.Bbox.null()
- bbox.update_from_data_xy(offsets)
- return bbox
+ if self._has_offsets:
+ # this is for collections that have their paths (shapes)
+ # in physical, axes-relative, or figure-relative units
+ # (i.e. like scatter). We can't uniquely set limits based on
+ # those shapes, so we just set the limits based on their
+ # location.
+ offsets = (offset_trf - transData).transform(offsets)
+ # note A-B means A B^{-1}
+ offsets = np.ma.masked_invalid(offsets)
+ if not offsets.mask.all():
+ bbox = transforms.Bbox.null()
+ bbox.update_from_data_xy(offsets)
+ return bbox
return transforms.Bbox.null()
def get_window_extent(self, renderer): |
This was referenced Apr 30, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug summary
On a9dd8b9 things are fine, on the next commit 396a010 from #22175 we get an error with previously working animation code.
Code for reproduction
This is nowhere near self-contained, but it will probably take me some time to make a self-contained example. In the meantime I wanted to post this issue in case it was clear from the traceback andgit bisect
what the problem is.Actual outcome
Expected outcome
No error
Additional information
No response
Operating system
Ubuntu 22.04
Matplotlib Version
396a010
Matplotlib Backend
QtAgg (PyQt6)
Python version
3.10.4
Jupyter version
No response
Installation
git checkout
The text was updated successfully, but these errors were encountered: