-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Allow Artists to show pixel data in cursor display #3989
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
Changes from 1 commit
34854db
7e0d1ca
97640da
139d820
17e4211
fcda62b
8ea9504
02456b8
641304c
3f20d3a
5850150
88b56be
aece695
07745c8
7626394
7b0b6b1
f5ff73f
ea565c6
1429206
e62b0e3
34b4df4
8f266a1
70983ff
cd0e52b
8ce3a6f
bac8dff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2800,6 +2800,12 @@ def mouse_move(self, event): | |
except (ValueError, OverflowError): | ||
pass | ||
else: | ||
ax = event.inaxes | ||
artists = ax.artists + ax.images + ax.lines | ||
artists = [a for a in artists if a.contains(event)[0]] | ||
if artists: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something seems odd about checking if Also, +1 for removing ye olden style DSU in favor of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call, done. |
||
artist = artists[np.argmax([a.zorder for a in artists])] | ||
s += artist.get_zdata(event) | ||
if len(self.mode): | ||
self.set_message('%s, %s' % (self.mode, s)) | ||
else: | ||
|
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.
Should also look at
ax.collections
(that is where things like scatter live) and maybeax.patches
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.
and the order should be
ax.collections + ax.patches + ax.lines + ax.artists + ax.images
to match the order used for sorting out the rendering order inAxes.draw
(around https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/axes/_base.py#L1993 images are special cased around line 2030).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.
They then get ordered by zorder anyway: https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/axes/_base.py#L2036
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.
Right, but the ordering is a stable sort so ties are broken by which was in the list first. This is the source of at least one un-fixable (with out major overhaul of the internal data structure, see #3944) bug ( #409 ).
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.
Ok then. So how to handle composite images? It does not seem feasible to recreate the composite every time.
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.
The
AxesImage
could composite the specific pixel on demand.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.
I think to first order, just ignore the compositing and use the top image.
The in-place compositing is only for some of the vector backends which can't do it them selves (ex pdf) to try and save space (so you don't have multiple overlapping images) but it leads to other bugs as all images get smashed to the same zorder relative to the other lines etc. In Agg (which backs all but 3 (gtkcairo, macsox and windows) of the interactive backends) the whole
if _do_composite
block is skipped and the compsiting is taken care of at the c++ layer.