Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
FIX: bypass inverse in collection#17206
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
5f878c1
to20ab0fa
Compare20ab0fa
to229b49e
Compare229b49e
toa53833e
CompareQuLogic commentedApr 22, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
This works for me, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
👍 works for me, thanks for the quick investigation and fix!
anntzer commentedApr 22, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Untested, but I think something along the lines of the following may work too, be simpler, and cover more cases? diff --git i/lib/matplotlib/collections.py w/lib/matplotlib/collections.pyindex 181e46b45..55a681000 100644--- i/lib/matplotlib/collections.py+++ w/lib/matplotlib/collections.py@@ -211,8 +211,6 @@ class Collection(artist.Artist, cm.ScalarMappable): # we may have transform.contains_branch(transData) but not # transforms.get_affine().contains_branch(transData). But later, # be careful to only apply the affine part that remains.- if not transOffset.is_affine:- offsets = transOffset.transform_non_affine(offsets) if isinstance(offsets, np.ma.MaskedArray): offsets = offsets.filled(np.nan)@@ -226,7 +224,8 @@ class Collection(artist.Artist, cm.ScalarMappable): # also use this algorithm (like streamplot). result = mpath.get_path_collection_extents( transform.get_affine(), paths, self.get_transforms(),- offsets, transOffset.get_affine().frozen())+ transOffset.transform_non_affine(offsets),+ transOffset.get_affine().frozen()) return result.transformed(transData.inverted()) if not self._offsetsNone: # this is for collections that have their paths (shapes)@@ -234,14 +233,13 @@ class Collection(artist.Artist, cm.ScalarMappable): # (i.e. like scatter). We can't uniquely set limits based on # those shapes, so we just set the limits based on their # location.- # Finish the transform:- offsets = (transOffset.get_affine() +- transData.inverted()).transform(offsets)+ offsets = (transOffset - transData).transform(offsets) offsets = np.ma.masked_invalid(offsets) if not offsets.mask.all(): points = np.row_stack((offsets.min(axis=0), offsets.max(axis=0))) return transforms.Bbox(points)+ return transforms.Bbox.null() def get_window_extent(self, renderer): The point is that |
Ireally don't understand why transforms were implemented withadd andminus to really mean multiplication and multiplication by the inverse. Worse, these operators are, as far as I can tell,completely undocumented. So I'm not in favour of adding them to the code until this situation improves. |
Woah, that is confusing! I was looking at your changelog and got really confused with what was happening because it never crossed my mind that + could ever mean multiplying two transformations together. |
I should stipulate that |
There was one transform operator in the code before (an addition: As to why multiplication and division are implemented as addition and subtraction: I didn't make that choice so I can't tell, but it's not a completely silly choice either. In particular, if you follow the matrix multiplication semantics, you'd have |
Ha ha, guess why? I've implement it with the minus sign and put a comment. The extra code in |
... added a simple test as well.. |
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon! If these instruction are inaccurate, feel free tosuggest an improvement. |
OK, I have real troubles manually backporting:
Like maybe this PR isn't worth back porting, but the instructionsused to work |
kannes commentedApr 27, 2020
Works fine for me on a fresh git clone, maybe you need to |
…3.2.xMerge pull request#17206 from jklymak/fix-bypass-inverse-collection
PR Summary
I think thisfixes#17203. If anyone has a dev environment where#17203 is triggered can you test this? It bypasses transforming the offsets if the offset transform and the data transform are the same.
PR Checklist