| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
Should also look at ax.collections (that is where things like scatter live) and maybe ax.patches
Sorry, something went wrong.
There was a problem hiding this comment.
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 in Axes.draw (around https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/axes/_base.py#L1993 images are special cased around line 2030).
Sorry, something went wrong.
There was a problem hiding this comment.
They then get ordered by zorder anyway: https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/axes/_base.py#L2036
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
Ok then. So how to handle composite images? It does not seem feasible to recreate the composite every time.
Sorry, something went wrong.
There was a problem hiding this comment.
The AxesImage could composite the specific pixel on demand.
Sorry, something went wrong.
There was a problem hiding this comment.
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.
Sorry, something went wrong.
|
How's that? I noticed onRemove was doing something similar and found Artist.hitlist(), and standardized between the two. |
Sorry, something went wrong.
|
However, it looks like Axes.get_children needs to return the same order as Axes.draw. New PR for that? |
Sorry, something went wrong.
|
onRemove looks like another candidate (along with onHilite) for removal from FigureCanvasBase (now that you have simplified it).... Probably worth having a top-level module for useful event handlers, which I think we greatly reduce the threshold to get people using the event system. @WeatherGod @joferkington thoughts? Yes to separate PR for re-ordering Axes.get_children as that is a (subtle) api change. |
Sorry, something went wrong.
|
I think we do need to handle compositing. For instance, if I run this example, I get the Zdata for the overlay layer. How about just checking for alpha=0 and then using the underlying in that case? |
Sorry, something went wrong.
|
Well, the more I think about it the more I agree that the top image should get priority. The canny value really is the point of the example. |
Sorry, something went wrong.
|
Added Artist.format_zdata to centralize formatting. |
Sorry, something went wrong.
|
Do I still "need revision"? |
Sorry, something went wrong.
|
Looks good to me. I am a tad wary of the format_z method which does not use self, but that seems like a reasonable place to put it. I would like @WeatherGod to weigh in. |
Sorry, something went wrong.
|
What do you mean "does not use self"? |
Sorry, something went wrong.
|
Meaning it should be a static method? |
Sorry, something went wrong.
|
Either way I think it belongs in the class so it can be overridden. |
Sorry, something went wrong.
|
Yes, it is an instance method which does not refer to it's instance and I can't think of a use case where you would want to (but I may just have poor imagination). I thought about suggesting to move it to cbook, but it is much too specific for that. |
Sorry, something went wrong.
|
I'd worry that adding a @staticmethod would give people the impression they could not subclass it as an instance method (I checked, and you can). |
Sorry, something went wrong.
|
This also needs an entry in https://github.com/matplotlib/matplotlib/tree/master/doc/users/whats_new |
Sorry, something went wrong.
|
Done. |
Sorry, something went wrong.
|
@matplotlib/developers Can this get eyes from someone else but me? This addresses a long standing and frequent feature request in a pleasingly general way. |
Sorry, something went wrong.
There was a problem hiding this comment.
Why do you want to use a string for this? Shouldn't "data" always be numeric?
Sorry, something went wrong.
There was a problem hiding this comment.
This allows the Artist to control the display of numbers, similar to the existing ax.format_coord.
Sorry, something went wrong.
There was a problem hiding this comment.
I agree with @efiring on this one. I can think of a lot of use cases (e.g. interactive sampling) where it would be very convenient to access a "raw" value. Returning a numerical value would make this method useful for a lot more than just display.
You already have a separate method for the formatting, so it's only slightly more verbose to flip the function calls on their head and make the displayed string using artist.format_zdata(artist.get_zdata()). In my opinion, this would be a better approach overall.
Sorry, something went wrong.
There was a problem hiding this comment.
Ha! I originally meant to do that...
Sorry, something went wrong.
|
@joferkington again. Sorry to pester, but I see you are doing OSS stuff today and would like your feed back on this 😄 |
Sorry, something went wrong.
|
@tacaswell - Absolutely! Sorry I've been so out-of-touch with things lately, as well. |
Sorry, something went wrong.
ENH: Allow Artists to show pixel data in cursor display
| Back | FazBrowse Home | New Git URL |
Also adds implementation for AxesImage. Closes #3984.
Inspired by mpldatacursor.