Widget rendering in Jupyter but not in Bokeh App
See original GitHub issueI wrote a small application that renders beautifully in Juypter and shows the dropdown menu with the additional but unused dimension “date”.
But when I deploy it to a bokeh app, the widget is not shown.
# Create the main plot
def create_map_figure(data):
import geoviews as gv
import holoviews as hv
import geoviews.tile_sources as gts
from holoviews import dim, opts
from colorcet import rainbow
gv.extension("bokeh")
plot_width = 800
plot_height = 400
tile_opts = dict(height=plot_height, xaxis=None, yaxis=None, show_grid=False)
map_tiles = gts.CartoLight.opts(style=dict(alpha=1), plot=tile_opts)
points_ds = gv.Dataset(data[["lon", "lat", "val", "date"]])
points = (points_ds.to(gv.Points, kdims=["lon", "lat"], vdims=["val"])
.options(active_tools=['wheel_zoom'], tools=["hover"])
.opts(colorbar=True, cmap=rainbow)).opts(opts.Points(color=dim('val'), size=5))
return map_tiles * points.redim.range(change=(0, 10))
def modify_doc(doc):
import holoviews as hv
from bokeh.layouts import column, row
from bokeh.models import Div
conn = get_db_connection()
df = get_data(conn)
plot_map = create_map_figure(df)
renderer = hv.renderer('bokeh').instance(mode='server')
plot_map_rendered = renderer.app(plot_map, doc)
doc.add_root(plot_map_rendered.state)
bokeh_app = Application(FunctionHandler(modify_doc))
server = Server(
{'/': bokeh_app},
io_loop=io_loop,
allow_websocket_origin=ALLOW_WEBSOCKET_ORIGIN,
debug=True,
**{'port': PORT, 'address': HOST}
)
server.start()
if __name__ == '__main__':
io_loop.add_callback(server.show, "/")
io_loop.start()
Issue Analytics
- State:
- Created 4 years ago
- Comments:16 (7 by maintainers)
Top Results From Across the Web
Bokeh/panel won't render in-line with Jupyter Lab
I'm trying to visualize Bokeh plots and panels with a Bokeh backend in a notebook in JupyterLab. Things were running fine until I...
Read more >Using with Jupyter — Bokeh 2.4.3 Documentation
Rendered cell output of the output_notebook call ensures that the BokehJS library loads. Otherwise, Bokeh plots will not work. If this cell's type...
Read more >panel.io.notebook — Panel v0.14.1 - HoloViz Panel
Various utilities for loading JS dependencies and rendering plots inside the Jupyter notebook. """ from __future__ import annotations import ...
Read more >Python data visualization with Bokeh and Jupyter Notebook
Data visualization in Python with Bokeh and Jupyter Notebook ... Luckily, Bokeh makes it pretty easy to render plots in Jupyter Notebooks!
Read more >Deploying Bokeh Apps — HoloViews v1.15.3
We can also easily use the server_doc method to get a Bokeh Document , which does not require you to make an instance...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here you go:
Not sure I follow, could you expand on this?
Yes,
pn.panel(hv_obj)._get_server(...)
. I think I’ll make that method public.