Coder Social home page Coder Social logo

Comments (9)

kuchaale avatar kuchaale commented on June 7, 2024

Does Bokeh with widgets (e.g. sliders) work when using output_notebook()?

from ma_visualization.

stoeckel4code avatar stoeckel4code commented on June 7, 2024

No. I tried it on this plot (associated code). The altidude is selected by a widget. It runs locally but not in the jupyter book.
image
image

from ma_visualization.

stoeckel4code avatar stoeckel4code commented on June 7, 2024

The problem is, that no python kernel is running. But there is a way to use the java script kernel, which runs in the browser.
Using this 'callbacks' may be the solution. But we have to change our code completly.

from ma_visualization.

kuchaale avatar kuchaale commented on June 7, 2024

Can you check this issue? The solution may be to export the bokeh notebook separately and then include it as an HTML file in the jupyter book.

from ma_visualization.

stoeckel4code avatar stoeckel4code commented on June 7, 2024

I tried it like this:

from bokeh.embed import file_html
from bokeh.resources import CDN
import IPython

html_repr = file_html(pn.Column(bars).get_root(), CDN)
IPython.display.HTML(html_repr)

this creates a html file but the widget don't works for now.

from ma_visualization.

kuchaale avatar kuchaale commented on June 7, 2024

Do widgets in the exported HTML file work at least? Our issue is related to issues that are still open, e.g. executablebooks/jupyter-book#1077 and executablebooks/jupyter-book#1113. One suggestion discussed there is to include html_extra_path in _config.yml in the following way:

sphinx:
  config:
    html_extra_path: path_to_external_html

Another question: did you try to update the bokeh library?

from ma_visualization.

stoeckel4code avatar stoeckel4code commented on June 7, 2024

I tried running my hv bars plot by:

...
bars = ds_wind.hvplot.scatter(y=['u','v'], symmetric =True, ylim=[-100,100], groupby='alt')
import holoviews as hv
fig = hv.render(bars, backend='bokeh')

Than I have a figure which I can implement in this (analog to the example):

from bokeh.plotting import figure, output_file, save

output_file("test.html")
save(fig)

This gives me a html-site, but the widget doesn't works.
My thoughts were, that I need a figure created by bokeh.plotting rather than holoviews or hvplot.
But bokeh.plotting doesn't works well with with the xarray dataset. Shall I try converting the dataset to a pandas dataset?
Or am I on a wrong way?

from ma_visualization.

kuchaale avatar kuchaale commented on June 7, 2024

Indeed, it may be an issue. Can you try this approach?

from ma_visualization.

stoeckel4code avatar stoeckel4code commented on June 7, 2024

Thank you, this works fine! You may check the html version of this simple plot out here.

from ma_visualization.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.