Skip to content
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

Add link_selections function for automated linked selections #3951

Merged
merged 2 commits into from
Oct 1, 2019

Conversation

jonmmease
Copy link
Collaborator

@jonmmease jonmmease commented Sep 11, 2019

Overview

This PR adds a holoviews.selection.link_selections function that is an initial implementation of the automatic linked selection approach proposed in #3842.

This function can be used to transform HoloViews objects into new objects with linked selections enabled.

Dependencies

This PR depends on the following open PRs, and will be rebased once these are merged.

Example notebook

For examples, see the notebook at https://anaconda.org/jonmmease/link_selections_pr/notebook.

Please play around with this notebook to get a feel for the workflow and capabilities and report back on how things look @jbednar @philippjfr @jlstevens.

Highlights

Linked Points plots with Bokeh backend:
points_layout


Linked Points, Histogram, Scatter3d, and Table layout with Plotly backend:
plotly_selections


Linked Violin, Points and Bivariate overlay, and Distribution layout with Bokeh backend:
bivariate_selections


Selections on datashaded elements
datashader_selection


Linked plots across notebook output cells, and updating selection color after display:
cross_cell_linking

Extensions

There is a lot more functionality that can be built on this foundation. Here are some directions:

  • The link_selections function only stores the latest selection. But the _base_link_selections base class is more general, and other subclasses can be added for cross filtering, and glue-style multi-color brushing.
  • Add Bounds element to display the selected region after a selection is completed. I think this will largely be a requirement for the cross-filter mode, otherwise it would be hard to make sense of the union of the selected regions across plots.
  • Selections could be displayed on grid elements (e.g. vector field, raster) if we had an element.where operation (Add element.where method support dim expressions #3933).
  • For full hvplot compatibility, will need to review hvplot to make sure source dataset information flows through all of the produced elements. This happens for some, but not all, elements at the moment.
  • Investigate geoviews compatibility
  • Dask optimization of dim expressions and histogram operation to make selection with datashader + histogram elements with Dask DataFrames scale well.
  • Support passing full Panel layouts to link_selections and traverse them to find HoloViews panes. This way a Panel layout with HoloViews panes that use different backends could be linked together.
  • Add a new BoundsPoly stream that is analogous to BoundsXY but for a polygon rather than a box. Use this to support defining selection regions using lasso selection.

Let me know which of these you think are capabilities that we really should have for the initial release. Thanks!

@jonmmease jonmmease added type: feature A major new feature status: WIP labels Sep 11, 2019
@jbednar
Copy link
Member

jbednar commented Sep 11, 2019

Fabulous! Can we have all of those things? :-) It is hard to choose!

@jonmmease
Copy link
Collaborator Author

after rebasing on the pipeline support, it's also possible to automate linked selections through custom aggregation steps. e.g.

bars = iris_ds.reindex(
    kdims='species_id', vdims=['sepal_length']
).to(hv.Bars).aggregate(function=np.sum)
link_selections(bars + points2)

aggregation_selection

@philippjfr
Copy link
Member

after rebasing on the pipeline support, it's also possible to automate linked selections through custom aggregation steps

Very, very neat.

@jbednar
Copy link
Member

jbednar commented Sep 20, 2019

Cool!!

@johnzzzzzzz
Copy link

nice

@jonmmease jonmmease force-pushed the link_selections branch 2 times, most recently from c99958a to 92382bf Compare September 26, 2019 12:55
@jonmmease
Copy link
Collaborator Author

All of the dependent PRs have been merged, so I squashed and rebased this PR on master. Review/feedback appreciated!

holoviews/core/util.py Outdated Show resolved Hide resolved
@philippjfr
Copy link
Member

Started reviewing but it looks to me like something went wrong during a merge or rebase and a number of preceding PRs are being reverted by this one.

@philippjfr
Copy link
Member

Once that's fixed I'm fine with merging this. I'd like to see a user guide on using linked selections along with a few reference and gallery examples but that can happen in later PRs.

@jonmmease
Copy link
Collaborator Author

Thanks for catching that @philippjfr, I think it's straightened out now and I won't force push on this PR again in case you want to leave comments inline. Thanks for taking a look!

@jbednar
Copy link
Member

jbednar commented Sep 26, 2019

Oh, that explains the seemingly unrelated changes! The diffs make much more sense now!

@philippjfr
Copy link
Member

There appears to be some Python 2 issue.

@jonmmease
Copy link
Collaborator Author

Yeah, those errors are a bit confusing. I'll build a local Python 2 environment and see what I can figure out.

@philippjfr
Copy link
Member

Very excited about this! Going to merge now.

@philippjfr philippjfr merged commit ae69535 into master Oct 1, 2019
philippjfr pushed a commit that referenced this pull request Oct 2, 2019
* Add link_selections support

* Fix python2 issue
@philippjfr philippjfr deleted the link_selections branch October 2, 2019 17:11
@jonmmease
Copy link
Collaborator Author

Great! Thanks for tracking down the python 2 issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature A major new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants