How to use Neptune with Bokeh#
Bokeh is a Python library for creating interactive visualizations for modern web browsers. With Neptune, you can log and display Bokeh charts as interactive HTML.
See in Neptune  Example script 
Before you start#
- Sign up at neptune.ai/register.
- Create a project for storing your metadata.
-
Have Bokeh and Neptune installed:
Tip
To follow the guide without any setup, run the example notebook in Colab
Bokeh logging example#
-
Import Neptune and start a run:
-
If you haven't set up your credentials, you can log anonymously:
-
-
Create a sample figure:
import numpy as np from bokeh.plotting import figure N = 500 x = np.linspace(0, 10, N) y = np.linspace(0, 10, N) xx, yy = np.meshgrid(x, y) d = np.sin(xx) * np.cos(yy) p = figure(tooltips=[("x", "$x"), ("y", "$y"), ("value", "@image")]) p.x_range.range_padding = p.y_range.range_padding = 0 # Pass a vector of image data as the 'image' argument p.image( image=[d], x=0, y=0, dw=10, dh=10, palette="Spectral11", level="image" ) p.grid.grid_line_width = 0.5
-
Upload the interactive figure:
-
To stop the connection to Neptune and sync all data, call the
stop()
method:
To open the run, click the Neptune link that appears in the console output.
[neptune] [info ] Neptune initialized. Open in the app:
https://app.neptune.ai/workspace/project/e/RUN-1
Result
The resulting figure is logged as an HTML object.
You can view it in the All metadata section.