-
-
Notifications
You must be signed in to change notification settings - Fork 404
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
Support link_selections on dynamic overlays #4683
Conversation
Thanks! What cases wouldn't be handled? I had thought that an hv.Overlay generated with the |
That's what I had thought as well, but turns out that
It doesn't handle the general case where someone writes a custom dynamic map callback function that returns an overlay, but I'm not sure there is a meaningful way to handle this case. |
I wonder if the regular Overlay constructor should be extended to do the same as |
That is correct. The issue here is that Nothing stops us having an The only other thought I have is that you could detect when you are supplied |
We could easily add a |
I'm not sure how I feel about constructors that give you a different type as a result. Also, |
Not sure what you mean by the second point. What I was suggesting wouldn't affect the * behavior so what would be toggled between? |
I think there are cases where I suppose this structure tells you to run |
I suppose link_selections can just do the introspection and apply the collate itself so a user doesn't have to. |
Right. I suppose the question is now whether:
I vote for option 2 as I think it shouldn't be too hard to do and I think option 3 is a big drastic right now. |
Thanks for explaining all that; I did suspect it was related to If link_selections does that, are there then any remaining overlay-like things (i.e. Overlays and things dynamically returning Overlays) that won't be supported for link_selections, assuming the things in the overlay are individually supported? Also, what about elements in the Overlay that aren't supported for link_selections? I would hope that those can just be ignored, so that their presence does not break the overall usability of the overlay. Maybe it should warn for such Elements, so that the user knows some elements are being ignored, but allow the warning to be silenced with an explicit argument to link_selections. (And the warning could mention the name of that argument, so that it's easy for the user to do the right thing.) The reason I'm asking is that previously using link_selections with an overlay was very awkward and required learning new concepts (grabbing the ls object and applying it individually to the bits that work), and I'd really hope that only really weird circumstances would need special treatment like that. |
The trouble is that, currently, import holoviews as hv
from holoviews.operation.datashader import datashade
from holoviews.plotting.util import initialize_dynamic
dmap_overlay = hv.Points([(0, 0)]) * datashade(hv.Points([0, 0]))
dmap_overlay
dmap_overlay.collate()
We could potentially move the approach that I used in this PR to update
I think this covers everything that we can reasonably cover. Elements in the overlay (dynamic or not) that don't support selections are retained unmodified. There is not warning at the moment though. This worked previously with the result of As I mentioned before, if someone builds a |
I must be confused or missing something... I thought the case that needs |
Right, that was my understanding as well, specifically you said:
So why would collate be needed for that case at all? Our suggestion was to handle |
I guess you assumed that we were suggesting that collate could somehow replace what you've done here, which is not the case. We were simply suggesting that we could cover the |
Ohh, I see. Thanks for clarifying. I was confused because the holoviews/holoviews/selection.py Lines 187 to 189 in 886b03d
This makes sense to me because it's the same logic path that regular (non-dynamic) overlays follow. But yeah, if you all want I think we could probably call |
Right -- that's what I'm after. Keeping all the progress you've made in this PR, but using collate on Overlays so that it can go even further and cover more cases (hence my question about what's still not covered if this extension is made to the PR). ETA: this comment was written before Jon's; it is replying to Philipp, not Jon! |
I think it's worth a try, because it addresses a class of inputs that we know is going to fail, so it's a known fix against a possible but unknown possibility of breakage. We can always revert it, but it does seem worth trying! |
It's not clear to me what these cases are. The current state of this PR handles |
I think the proposal is to call .collate() for this case and thereby cover it. Right? |
I'll think on it some more, but right now I don't see how collate would help with that case. @philippjfr and @jlstevens? |
Yeah, I hadn't realized |
No, I appreciate you weighing in. There's a lot going on here so I really appreciate whatever comes to your mind 🙂 |
layers combined by the `dynamic_mul` callback.
886b03d
to
f729df7
Compare
The MacOS failures are unrelated. Merging. |
Thanks, @philippjfr! |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This PR adds support for performing
link_selections
on DynamicMaps that are the result of performing the__mul__
operator on one or more DynamicMap layers.This came up when trying to use
link_selections
and datashader together on top of aTiles
element.e.g.
The result of
tiles * datashade(...)
is aDynamicMap
that returns anOverlay
. Previously we skipped these inlink_selections
because it's not possible to accurately recurse in the general case.This PR handles only the very common case of DynamicMaps generated by the
__mul__
operator.