-
-
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
Polishing and improving the tutorials added in 1.7 #1384
Conversation
doc/Tutorials/Linked_Streams.ipynb
Outdated
"\n", | ||
"<center><div class=\"alert alert-info\" role=\"alert\">To use and visualize <b>DynamicMap</b> or <b>Stream</b> objects you need to be running a live Jupyter server.<br>This tutorial assumes that it will be run in a live notebook environment.<br>\n", | ||
"When viewed statically, DynamicMaps will only show the first available Element,<br></div></center>\n", | ||
"\n", | ||
"## Available Linked Streams\n", | ||
"\n", | ||
"There a huge number of ways one might want to interact with a plot. The HoloViews streams module aims to offer many of the most common interactions you might want to specify while making it easy to extend it with custom linked Streams. \n", | ||
"There are a huge number of ways one might want to interact with a plot. The HoloViews streams module aims to expose many of the most common interactions you might want want to engage in, while also supporting extensibility via ustom linked Streams. \n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"engage in" seems awkward, maybe "utilize" or "employ"
Also "ustom linked Streams"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'employ' sounds good and I'll fix the typo now.
I've updated the notebook format version because the diffs were getting too miserable - all because of a minor version bump in the format. |
I am skipping over the 'Unlinking streams' section and going through the rest of the tutorial. I think that section needs a better example to illustrate why you might want to unlink. |
@philippjfr Maybe |
I've updated the last section:
|
I'm done making edits to the linked streams tutorial for now. There are two things I would like to see:
I'm happy to review the tutorial and have another pass once these things are added. |
I've now replaced the crosshairs with a better example of dimensioned streams: There are two things to mention though:
xs = np.linspace(-3, 3, 400)
def function(xs, time):
"Some time varying function"
return np.exp(np.sin(xs+np.pi/time))
def integral(limit, time):
limit = -3 if limit is None else limit
curve = hv.Curve((xs, function(xs, time)))[limit:]
area = hv.Area((xs, function(xs, time)))[:limit]
summed = area.dimension_values('y').sum() * 0.015 # Numeric approximation
return (area * curve * hv.VLine(limit) * hv.Text(limit + 0.8, 2.0, '%.2f' % summed))
hv.DynamicMap(integral, kdims=['time'], streams=[Stream.define('Time', time=1.0)(),
streams.PointerX().rename(x='limit')]) @philippjfr It might be nice to make such a link between the tutorials. Do you have a use for this example in the linked streams tutorial? |
I will rebase now so I can make edits to the new operation tutorial if necessary. |
426cf17
to
3c6c160
Compare
In addition I am assuming issue #1386 will be addressed having removed all mention of |
I'm done making edits on the Operations tutorial for now. I am very happy with the examples it uses and I think the main issue now is merging the required PRs I mention above. |
In my last commit, I add a new section about what to do when you don't have an operation that maps over elements: I recommend always using |
ee8cd55
to
c5611bb
Compare
Note that I added @philippjfr @jbednar @ceball This PR is ready now, all feedback on these three new tutorials (Streams, Linked Streams, Operations) is welcome! |
As one final note, adding the following code (thanks @philippjfr !) is the same as applying clipjs = "if (x_range.type.endsWith('Range1d')) { if (cb_obj.x < x_range.start) { data['x'] = x_range.start } else if (cb_obj.x > x_range.end) { data['x'] = x_range.end }}"
hv.plotting.bokeh.callbacks.PointerXYCallback.code = clipjs
hv.plotting.bokeh.callbacks.PointerXYCallback.models.append('x_range') We can decide whether to make this the default (and tidy up the code) in a separate PR. |
doc/Tutorials/Linked_Streams.ipynb
Outdated
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Now try hovering over the ``Image`` above again and watch the cross-sections update as you move the cursor." | ||
"Now if we display a ``Layout`` consisting of the ``Image`` acting as the source together with the ``DynamicMap``, the point shown on the right tracks the cursor position when hovering voer the image on the left:" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: hovering over
Looks great, all good improvements. Merging. |
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 aims to improve our new tutorials before 1.7.1 is released, hopefully getting the improved versions of the tutorials live before then. The tutorials to improve are:
DynamicMap, Streams
andLinked_Streams
and they are expected to be read in that order.I think any of us can use this PR to make the improvements we feel are necessary. Obviously anything that might be controversial should be discussed first!
My first commit improves the listing of available linked stream classes.