8000 Bounds checking for get_cursor_data(). Closes #4957 by WeatherGod · Pull Request #4961 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Bounds checking for get_cursor_data(). Closes #4957 #4961

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

Merged
merged 1 commit into from
Aug 19, 2015

Conversation

WeatherGod
Copy link
Member

Decided to go with reporting None when outside the image. There is still an oddity I discovered, and I highlighted it in the test with commented out code. With origin as "upper", you can go off the top-left corner of the image for a bit with a value being reported. This doesn't happen at any corner for origin "lower", though.

@tacaswell tacaswell added this to the next point release milestone Aug 19, 2015
@tacaswell
Copy link
Member

Less than thrilled about the the variability of the types, but I think it is ok in this case.

I am more concerned that im.contains(ev) in apparently coming up as True even if the event is not in the image.

@WeatherGod
Copy link
Member Author

Ah, I see a bug there, I think. contains() is assuming that get_extents() returns min/max/min/max. It doesn't, it returns left/right/top/bottom.

@WeatherGod
Copy link
Member Author

errr, I mean left/right/bottom/top

@tacaswell
Copy link
Member

It looks worse that that. In the case of the default extent it looks like get_extent compensates, but in the case of a specified extent does not!

@WeatherGod
Copy link
Member Author

Joys! Well, the fix is fairly straight-forward, if tedious. Just do a flip of xmin/xmax and ymin/ymax whenever needed. Stay tuned...

@WeatherGod
Copy link
Member Author

I am thinking that is a red herring. The only place where doing an order check would have helped is with FigureImage's contain(), and its get_extent() operates in a way that always returns left/right/bottom/top.

In any case, bounds-checking should be par for course, even if get_cursor_data() should not have been called in the first place. We could open up a new issue to investigate that further. Maybe a faulty contains() elsewhere is causing excess hitlist triggers and is a source of the performance degradation?

tacaswell added a commit that referenced this pull request Aug 19, 2015
FIX: Bounds checking for get_cursor_data(). 

Closes #4957
@tacaswell tacaswell merged commit 6b9ff9c into matplotlib:master Aug 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0