bokeh
**Bokeh** is a **Python library for creating interactive visualizations that render as HTML/JavaScript in web browsers** — unlike Matplotlib (which produces static PNG images), Bokeh creates interactive plots with built-in zoom, pan, hover tooltips, and selection tools, supports real-time streaming data updates through its Bokeh server, and can build full data dashboards without requiring any JavaScript knowledge, making it the ideal choice for data scientists who need web-based, interactive visualizations.
**What Is Bokeh?**
- **Definition**: An open-source Python visualization library (pip install bokeh) that generates interactive plots as standalone HTML files or server-backed applications — targeting modern web browsers with JSON-based rendering rather than static image export.
- **The Key Difference**: Matplotlib creates rasterized images (.png, .svg). Bokeh creates interactive HTML/JavaScript files. You can zoom into a scatter plot, hover over points to see their values, select a region to filter data — all in the browser with no additional code.
- **Architecture**: Bokeh works by converting Python objects into a JSON representation (BokehJS documents), which the browser's JavaScript engine renders. This means plots can be embedded in web pages, Jupyter notebooks, or served as live dashboards.
**Core Interactivity**
| Tool | Action | Use Case |
|------|--------|----------|
| **Pan** | Click and drag to move around the plot | Exploring large datasets |
| **Zoom** | Scroll wheel or box select to zoom | Focus on a specific region |
| **Hover** | Mouse over a point to see its data | Inspect individual data points |
| **Tap/Select** | Click points to select them | Link selections across multiple plots |
| **Lasso Select** | Draw freeform region to select points | Irregular region selection |
| **Reset** | Return to original view | Quick navigation |
**Bokeh Interfaces**
| Interface | Level | Use Case |
|-----------|-------|----------|
| **bokeh.plotting** | Mid-level (most common) | Standard charts with interactivity |
| **bokeh.models** | Low-level | Full control over every visual element |
| **bokeh.io** | Output | Save to HTML file or display in notebook |
| **bokeh.server** | Application | Live dashboards with Python callbacks |
**Bokeh vs Other Visualization Libraries**
| Feature | Bokeh | Matplotlib | Plotly | Altair | Seaborn |
|---------|-------|-----------|--------|--------|---------|
| **Output** | HTML/JS (interactive) | PNG/SVG (static) | HTML/JS (interactive) | HTML/JS (interactive) | PNG (static, matplotlib-based) |
| **Interactivity** | Built-in (zoom, hover, select) | None (static) | Built-in | Built-in | None |
| **Streaming** | Yes (Bokeh server) | No | Limited | No | No |
| **Dashboard** | Bokeh server | No | Dash framework | No | No |
| **Learning Curve** | Moderate | Low | Low | Low | Very low |
| **Best For** | Interactive dashboards, streaming | Publication plots | Quick interactive plots | Declarative grammar | Statistical plots |
**Bokeh is the Python library for building interactive, browser-based data visualizations** — providing built-in zoom, pan, hover, and selection tools without any JavaScript, supporting real-time data streaming through the Bokeh server, and enabling full dashboard applications that connect interactive plots to Python backend logic for live data exploration.