> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.conductorquantum.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.conductorquantum.com/_mcp/server.

# stanza.plotter.backends.server

Server-based plotting backend for live visualization in browser.

Runs a Bokeh server in a background thread, streams data updates via WebSocket.
Works from any environment: scripts, notebooks, or interactive sessions.

## Module Contents

### Classes

| Name | Description |
|------|-------------|
| [`ServerBackend`](#stanzaplotterbackendsserverserverbackend) | Live plotting in browser via Bokeh server. |

### Data

`logger`

### API

```python
stanza.plotter.backends.server.logger
```

**Value**: `getLogger(...)`


```python
class stanza.plotter.backends.server.ServerBackend(port: int = 5006, daemon: bool = True, session_token_expiration: int = sys.maxsize)
```

Live plotting in browser via Bokeh server.

Runs embedded server in background thread. Server dies when parent process exits.

```python
start(block: bool = False) -> None
```

Start Bokeh server.

**Parameters:**

<ParamField path="block" type="bool" default="False">
  If True, blocks until server is stopped (for persistent mode).
</ParamField>


```python
stop() -> None
```

Stop the Bokeh server and remove from active servers registry.


```python
reset() -> None
```

Reset the document, clearing all plots and data sources.

This allows reusing the same server instance across multiple sessions.


```python
create_figure(
    name: str,
    x_label: str,
    y_label: str,
    plot_type: str = 'line',
    z_label: str | None = None,
    cell_size: tuple[float, float] | None = None
) -> None
```

Register a new plot. Created when browser connects.


```python
_create_plot(name: str) -> None
```

Create plot based on spec.


```python
_create_line_plot(name: str) -> None
```

Create 1D line plot.


```python
_create_heatmap_plot(name: str) -> None
```

Create 2D heatmap with rect glyph and linear color mapping.


```python
stream_data(
    name: str,
    new_data: dict[str, typing.Any],
    rollover: int | None = None
) -> None
```

Add data to plot. Buffers if browser not yet connected.