Bokeh: Interactive Visualization for Modern Web Browsers
Overview Bokeh is a Python library for creating interactive visualizations for modern web browsers. It creates versatile, data-driven graphics with high-performance interactivity over large or streaming datasets.
Key Differentiators
1. Server-Side Callbacks Unlike Plotly (which is mostly client-side JS), Bokeh has a powerful Python Server.
- Setup: User clicks a button in the browser.
- Action: Request sent to Python server.
- Server: Python calculates a complex simulation.
- Browser: Updates the graph.
This allows for building heavy-duty data applications entirely in Python.
2. Large Data Bokeh can use WebGL for high-performance rendering of thousands of points.
3. Linking Plots You can link the behavior of multiple plots. Selection on one scatter plot can highlight the corresponding data in a table or another plot.
Example
from bokeh.plotting import figure, show
p = figure(title="Simple Line", x_axis_label='x', y_axis_label='y')
p.line([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], legend_label="Temp.", line_width=2)
show(p) # Opens an HTML file
Bokeh vs Plotly
- Plotly: Easier AP (Express), better for standard charts.
- Bokeh: Better for building complex custom dashboard applications with Python callbacks.
Bokeh is often used in scientific/engineering contexts where custom interaction is required.
Explore 500+ Semiconductor & AI Topics
From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.