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

Testing the bokeh Elements tutorial and matching the original #334

Closed
jlstevens opened this issue Dec 6, 2015 · 20 comments
Closed

Testing the bokeh Elements tutorial and matching the original #334

jlstevens opened this issue Dec 6, 2015 · 20 comments
Assignees
Labels
tag: backend: bokeh tag: component: testing type: docs Related to the documentation and examples
Milestone

Comments

@jlstevens
Copy link
Contributor

I think it would be great to just copy the current Elements tutorial, set hv.notebook_extension(bokeh=True) at the top and make it available on the website (the tutorials could then be called Elements [matplotlib] and Elements [bokeh]. This would achieve a few things:

  1. Show some official bokeh examples on or website.
  2. Show how easy it is to use the same code and switch backends.
  3. Test our bokeh support.
  4. Show people the full range of things that can be done with the bokeh backend.

The main issues I can see are:

  1. Setting this up on Travis (I think bokeh is already installed though).
  2. Getting display tests working for bokeh. This may be tricky if there is a fair bit of randomness (e.g uuids) in the bokeh output given the same input.
@jlstevens jlstevens added type: docs Related to the documentation and examples tag: backend: bokeh labels Dec 6, 2015
@jlstevens jlstevens added this to the Post v1.4.0 milestone Dec 6, 2015
@jlstevens
Copy link
Contributor Author

I forgot to mention you'll need %output backend='bokeh' too (maybe notebook_extension should switch for you?). I also notice that some things still aren't available (e.g VectorField?) and when I run this cell, the rest of the notebook doesn't run:

data = [('one',8),('two', 10), ('three', 16), ('four', 8), ('five', 4), ('six', 1)]
bars = hv.Bars(data, kdims=[hv.Dimension('Car occupants', values='initial')], vdims=['Count'])
bars + bars[['one', 'two', 'three']]

@philippjfr
Copy link
Member

I've already added a version of the Elements Tutorial using Bokeh. Do still need to get bokeh testing working though.

@jlstevens
Copy link
Contributor Author

Ah, yes... I see that commit fro 19 hours ago. :-)

Though it would be good if it were made as similar to the original tutorial as possible (e.g the issue above). What do you think about effectively calling the output magic to switch backends when using notebook_extension(bokeh=True)? I guess it gets confusing if you load JS for multiple things because then it gets ambiguous...

@jlstevens jlstevens changed the title A bokeh version of the Elements tutorial Testing the bokeh Elements tutorial and making it more like the original Dec 6, 2015
@jlstevens jlstevens changed the title Testing the bokeh Elements tutorial and making it more like the original Testing the bokeh Elements tutorial and matching the original Dec 6, 2015
@jlstevens
Copy link
Contributor Author

Ok, I changed the title of the issue. I'm sure you are already aware of some of the following problems but they are worth listing here anyway:

  • The index isn't rendering properly.. e.g a line shows up as [``Element``](#Element). This is true for the normal tutorial too (dev section of the website).
  • In Histogram you get a warning: WARNING:root:Options: Invalid options ['show_grid'], valid options are: ...
  • I think I would be in favor of matching up the index between Elements and Bokeh_Elements for ease of reference. Then we can just be honest about which elements aren't supported in the bokeh backend. For instance, I don't see why HSV isn't listed in the bokeh version...surely that is trivial to support?

In general, I think the tutorials should be as similar to each other as possible..

@jbednar
Copy link
Member

jbednar commented Dec 7, 2015

What do you think about effectively calling the output magic to switch backends when using notebook_extension(bokeh=True)? I guess it gets confusing if you load JS for multiple things because then it gets ambiguous...

I would definitely be in favor of this, with the last JS set loaded determining the default backend. Maybe this is already the behavior?

In general I agree with Jean-Luc's comments above; making a full Bokeh version (with stubs where required) would make it be clearest about what's supported and what's not (and would spur us to support whatever isn't. There should also probably be a fairly short tutorial somewhere that's specific to Bokeh, describing and demonstrating what's available in that backend that's not available elsewhere (brushing, linking, callbacks?).

@philippjfr
Copy link
Member

making a full Bokeh version (with stubs where required) would make it be clearest about what's supported and what's not (and would spur us to support whatever isn't.

These Elements could probably be supported fairly easily:

  • QuadMesh: Could be implemented as individual rectangles
  • Bars: Implemented in unmerged PR Bokeh charts #339
  • HSV: Should be easy
  • Arrow: Should land in bokeh 0.11
  • VectorField: Could also use arrow glyph

These can't:

  • Surface
  • Scatter3D
  • Trisurface

here should also probably be a fairly short tutorial somewhere that's specific to Bokeh, describing and demonstrating what's available in that backend that's not available elsewhere (brushing, linking, callbacks?).

I've got a notebook for that, I'll do some minor tidying but it's almost ready to go.

@jbednar
Copy link
Member

jbednar commented Dec 8, 2015

I'd urge you to make the change of having notebook_extension(bokeh=True) switch to Bokeh automatically very soon, so that it goes into the next minor release. That way we can simplify our user instructions, when telling people about the Bokeh support.

@jlstevens
Copy link
Contributor Author

I would definitely be in favor of this, with the last JS set loaded determining the default backend.

Yes, this makes sense. Definitely something we'll have for 1.4.1.

@philippjfr
Copy link
Member

Agreed, it should simply load extensions for all available backends by default. For matplotlib that's a no-op but the plotly backend prototype has something similar.

@jlstevens
Copy link
Contributor Author

Agreed, it should simply load extensions for all available backends by default.

That sounds useful to me (based on whether imports work or not, I presume?). Then if you supply an explicit list of 'resources' we should obey that.

It would mean that holoviews javascript wouldn't be included by default as soon as anything is set. E.g for initializing holoviews and bokeh only (even if something else is available) you would use:

notebook_extension(holoviews=True, bokeh=True) 

@jbednar
Copy link
Member

jbednar commented Dec 8, 2015

Hmm; we may not be agreeing here. Why include more than one backend initialization by default? I would have thought that as a user, if I type:

hv.notebook_extension() 

I would get support for the default backend (currently matplotlib), and that if I type:

notebook_extension(bokeh=True) 

I would only get Bokeh support, and that if I type:

notebook_extension(bokeh=True, matplotlib=True) 

I would get support for both bokeh and matplotlib and make matplotlib the default (which I'd expect from the left to right order, even if Python won't actually respect that :-), and that if I type:

notebook_extension(bokeh=True, matplotlib=True, plotly=True) 

I'd get support for all three, with plotly as the default, falling back to matplotlib when that Element type isn't supported by Plotly, then falling back to bokeh for anything not supported by matplotlib.

I'm not saying that it has to be like this, or that it's reasonable to be like this, it's just how I would expect it to behave: no support for backends I'm not using and may never have heard of, no need to explicitly specify any backend using %output later, and a list of preferred backends, in order.

@jlstevens
Copy link
Contributor Author

The idea of setting up fallbacks in this way is one Philipp and I have toyed with but we aren't completely convinced this is exactly the behavior we want. As it would also require some refactoring, this suggestion is something to think about after 1.4.1 is released.

For now what I have done (PR #374) is update notebook_extension to activate the last backend loaded in the resource list. As Jim noted, we can't know the specified order left-to-right using the keyword syntax:

notebook_extension(bokeh=True, matplotlib=True)

But now you can pass kwargs which is shorter and preserves the order:

notebook_extension('bokeh', 'matplotlib')

In this case, BokehJS would be loaded and the matplotlib backend would remain active. Specified the other way round and the bokeh backend would be automatically activated.

@jbednar
Copy link
Member

jbednar commented Dec 21, 2015

Looks good to me!

@philippjfr philippjfr modified the milestones: v1.4.2, Post v1.4.0 Jan 12, 2016
@philippjfr philippjfr self-assigned this Feb 4, 2016
@jlstevens
Copy link
Contributor Author

Are we going to try to implement the suggestion in #445 (backend icons) before we release 1.4.2?

@jlstevens
Copy link
Contributor Author

I will also note that although the Bokeh Elements tutorial has been updated to be like original matplotlib one, part of this issue was about testing Bokeh plots, something that is not yet in place.

@jlstevens
Copy link
Contributor Author

I think most of these changes have been implemented except for the suggestion in #455 which I think is a good idea. For this reason, I'll leave this issue open and reassign the milestone to v1.5.

@jlstevens jlstevens modified the milestones: v1.5.0, v1.4.2 Feb 7, 2016
@philippjfr philippjfr added this to the v1.6.0 milestone Apr 20, 2016
@philippjfr philippjfr removed this from the v1.5.0 milestone Apr 20, 2016
@philippjfr
Copy link
Member

We are now testing the bokeh element tutorial at least in Python 2. I think that addresses all the suggestions in this PR. In future we'll be splitting up the Element tutorial into individual examples so I'll close this issue now.

@jlstevens
Copy link
Contributor Author

Do we have an issue to record something related we discussed: a page with thumbnails for all the elements (linking to the right place in the tutorials) and a toggle to switch between matplotlib/bokeh?

@thoth291
Copy link
Contributor

Just noticed missing Arrow support for bokeh in that Elements tutorial.

scene * hv.Text(0, 0.2, 'Adult\npenguins') + scene * hv.Arrow(0,-0.1, 'Baby penguin', 'v')

WARNING:root:OverlayPlot03380: No plotting class for Arrow type and bokeh backend found.

@jbednar
Copy link
Member

jbednar commented Mar 16, 2017

Right; as discussed in #1196 that's the only non-3D Element not yet supported by the Bokeh backend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tag: backend: bokeh tag: component: testing type: docs Related to the documentation and examples
Projects
None yet
Development

No branches or pull requests

4 participants