Proposal: Ability to add new streams to DynamicMap.map() #5042
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a conceptual proposal and is not ready to merge. I would like to start a discussion on how to extend existing
DynamicMap
s with new streams.I think the ability to extend
DynamicMap
with new streams would be a great addition. Sometimes when creating a complex dashboard I have plots that are derived from other plots. If the source plots areDynamicMap
s I usually useDynamicMap.map()
to create the derived plot. For example I might make a projection as a derived plot that can be added to a Adjoint layout. An example of such a projection could be:However, sometimes I might want to create an additional interaction with the derived plot. However, adding a new stream with events, and the required effect of the stream event on the data, to an existing
DynamicMap
is currently not possible as far as I know (please correct me if I'm wrong).I was thinking I would be nice to extend
DynamicMap.map
(or maybe create a new mapping method) to allow for new streams to be passed to.map(streams=...)
, of which the parameters can be used in themap_fn
function.As a rough illustration how this could work I created this PR. And have created the following example that illustrates creating a derived plot (histogram) that depends on a new stream (
hv.streams.Selection1D
)Using the histogram and the selection are just examples of a derived plot and an additional stream here. They could be any other derivation on the original plot's data with any other event stream.
I would love to know what y'all think. Is this something Holoviews want to support? Do you think extending
DynamicMap.map(streams=...)
is the right way, or are there other routes to implementing this behaviour?