Updated attractors.ipynb to use hvplot and Panel #163
Closed
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.
As an exercise in our new hvPlot-centric approach to using our tools, I've updated attractors.ipynb to use hvplot and Panel instead of hv and DynamicMap. The goal isn't necessarily to make the code shorter, though it did reduce it slightly, it's to make the concepts easier to convey given what people already know about Pandas and how widgets work.
I think it's succeeded at that? Certainly the first couple of .hvplot calls are straightforward; there is data in a df, and we call hvplot on it.
The last example is less of a clear win. We can't use .interactive here because we're generating a new DataFrame each time, so I've used Panel and pn.bind. The old one only relied on HoloViews concepts throughout, from hv.Points to DynamicMap, which means that there was one place to go for reference, but even so the ideas were quite esoteric and surprising to people. The new one adds Panel widgets and pn.bind as concepts, which they do have to figure out, but I think they are easier to convey and it's also much, much clearer where to go from here. The user can see that if they wanted to put anything else on a widget, they can just define one and hook it in, whereas with DynamicMap it was unclear how to add a Boolean, Selector, etc.
The new code in that last cell is also somewhat dense, but I can't think of any easy way to simplify it without making it much, much more verbose.