# dataviz-rs/dataviz architecture

> Architecture diagram of the GitHub repository dataviz-rs/dataviz, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dataviz-rs/dataviz
- Repository: https://github.com/dataviz-rs/dataviz

## Overview

DataViz is a multi-language plotting library. Users build figures and charts through a language-facing API; the plotting core represents charts as a backend-independent scene, then serializes or rasterizes it for output. The map preserves documented grammar, interactive/live, domain-chart, accessibility, and language-binding capabilities. Some branches are documented but their internal calls were not sampled, so those links are dashed; edges for sampled core rendering stages cite the module documentation.

Main entry points: [`src/plot/figure.rs`](https://github.com/dataviz-rs/dataviz/blob/main/src/plot/figure.rs) (Figure and axes), [`src/plot/axes.rs`](https://github.com/dataviz-rs/dataviz/blob/main/src/plot/axes.rs) (Axes and series), [`src/plot/output.rs`](https://github.com/dataviz-rs/dataviz/blob/main/src/plot/output.rs) (File and pixel output), [`src/plot/scene.rs`](https://github.com/dataviz-rs/dataviz/blob/main/src/plot/scene.rs) (Drawing scene)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Language interfaces"]
  node_rust["Rust API<br/>[lib.rs]"]
  node_python["Python API<br/>[pyplot.py]"]
  node_wasm["JavaScript API<br/>[lib.rs]"]
  node_capi["C/C++ API<br/>[lib.rs]"]
  node_mcp["MCP server<br/>[main.rs]"]
end

subgraph group_plotting["Chart construction"]
  node_figure["Figure and axes<br/>[figure.rs]"]
  node_axes["Axes and series<br/>[axes.rs]"]
  node_axis["Axis mapping<br/>[axis.rs]"]
  node_grammar["Graphics grammar<br/>[grammar.rs]"]
  node_data["Data and tables<br/>[data.rs]"]
end

subgraph group_capabilities["Plot capabilities"]
  node_domain["Domain charts"]
  node_geospatial["Maps and geography<br/>[geo.rs]"]
  node_three_d["3D charts<br/>[three_d.rs]"]
  node_accessibility["Accessibility<br/>[a11y.rs]"]
end

subgraph group_rendering["Rendering and output"]
  node_scene["Drawing scene<br/>[scene.rs]"]
  node_raster["CPU rasterizer<br/>[raster.rs]"]
  node_gpu["GPU rasterizer<br/>[gpu.rs]"]
  node_output["File and pixel output<br/>[output.rs]"]
  node_html["Interactive HTML<br/>[html.rs]"]
  node_text["Text layout<br/>[text.rs]"]
end

subgraph group_interaction["Interaction and live"]
  node_window["Interactive windows<br/>[window.rs]"]
  node_interact["Window interaction<br/>[interact.rs]"]
  node_anim["Animation and live<br/>[anim.rs]"]
end

node_users(("Plot users"))

node_users -.->|"use library"| node_rust
node_users -.->|"use pyplot"| node_python
node_users -.->|"use browser API"| node_wasm
node_users -.->|"use bindings"| node_capi
node_users -.->|"request tools"| node_mcp
node_rust -.->|"create figures"| node_figure
node_python -.->|"create plots"| node_figure
node_wasm -.->|"create plots"| node_figure
node_capi -.->|"create figures"| node_figure
node_mcp -.->|"create plots"| node_figure
node_figure -.->|"provide axes"| node_axes
node_axes -->|"map coordinates"| node_axis
node_axes -->|"draw charts"| node_scene
node_grammar -.->|"build charts"| node_axes
node_data -.->|"supply data"| node_axes
node_domain -.->|"provide chart types"| node_axes
node_geospatial -.->|"provide map charts"| node_axes
node_three_d -.->|"draw 3D scene"| node_scene
node_accessibility -.->|"describe charts"| node_figure
node_scene -->|"render scene"| node_output
node_output -->|"rasterize pixels"| node_raster
node_output -.->|"use GPU backend"| node_gpu
node_output -.->|"write HTML"| node_html
node_output -.->|"layout text"| node_text
node_figure -.->|"show window"| node_window
node_window -.->|"handle input"| node_interact
node_figure -.->|"stream and animate"| node_anim

click node_rust "https://github.com/dataviz-rs/dataviz/blob/main/src/lib.rs"
click node_python "https://github.com/dataviz-rs/dataviz/blob/main/python/python/dataviz/pyplot.py"
click node_wasm "https://github.com/dataviz-rs/dataviz/blob/main/wasm/src/lib.rs"
click node_capi "https://github.com/dataviz-rs/dataviz/blob/main/capi/src/lib.rs"
click node_mcp "https://github.com/dataviz-rs/dataviz/blob/main/mcp/src/main.rs"
click node_figure "https://github.com/dataviz-rs/dataviz/blob/main/src/plot/figure.rs"
click node_axes "https://github.com/dataviz-rs/dataviz/blob/main/src/plot/axes.rs"
click node_axis "https://github.com/dataviz-rs/dataviz/blob/main/src/plot/axis.rs"
click node_grammar "https://github.com/dataviz-rs/dataviz/blob/main/src/plot/grammar.rs"
click node_data "https://github.com/dataviz-rs/dataviz/blob/main/src/plot/data.rs"
click node_domain "https://github.com/dataviz-rs/dataviz/tree/main/src/plot/series"
click node_geospatial "https://github.com/dataviz-rs/dataviz/blob/main/src/plot/geo.rs"
click node_three_d "https://github.com/dataviz-rs/dataviz/blob/main/src/plot/series/three_d.rs"
click node_accessibility "https://github.com/dataviz-rs/dataviz/blob/main/src/plot/a11y.rs"
click node_scene "https://github.com/dataviz-rs/dataviz/blob/main/src/plot/scene.rs"
click node_raster "https://github.com/dataviz-rs/dataviz/blob/main/src/plot/raster.rs"
click node_gpu "https://github.com/dataviz-rs/dataviz/blob/main/src/plot/gpu.rs"
click node_output "https://github.com/dataviz-rs/dataviz/blob/main/src/plot/output.rs"
click node_html "https://github.com/dataviz-rs/dataviz/blob/main/src/plot/html.rs"
click node_text "https://github.com/dataviz-rs/dataviz/blob/main/src/plot/text.rs"
click node_window "https://github.com/dataviz-rs/dataviz/blob/main/src/plot/window.rs"
click node_interact "https://github.com/dataviz-rs/dataviz/blob/main/src/plot/interact.rs"
click node_anim "https://github.com/dataviz-rs/dataviz/blob/main/src/plot/anim.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_rust,node_python,node_wasm,node_capi,node_mcp,node_users toneBlue
class node_figure,node_axes,node_axis,node_grammar,node_data toneAmber
class node_domain,node_geospatial,node_three_d,node_accessibility toneMint
class node_scene,node_raster,node_gpu,node_output,node_html,node_text toneRose
class node_window,node_interact,node_anim toneIndigo
```

## Components

### Language interfaces

- [Rust API](https://github.com/dataviz-rs/dataviz/blob/main/src/lib.rs): `src/lib.rs`
- [Python API](https://github.com/dataviz-rs/dataviz/blob/main/python/python/dataviz/pyplot.py): `python/python/dataviz/pyplot.py`
- [JavaScript API](https://github.com/dataviz-rs/dataviz/blob/main/wasm/src/lib.rs): `wasm/src/lib.rs`
- [C/C++ API](https://github.com/dataviz-rs/dataviz/blob/main/capi/src/lib.rs): `capi/src/lib.rs`
- [MCP server](https://github.com/dataviz-rs/dataviz/blob/main/mcp/src/main.rs): `mcp/src/main.rs`

### Chart construction

- [Figure and axes](https://github.com/dataviz-rs/dataviz/blob/main/src/plot/figure.rs): `src/plot/figure.rs`
- [Axes and series](https://github.com/dataviz-rs/dataviz/blob/main/src/plot/axes.rs): `src/plot/axes.rs`
- [Axis mapping](https://github.com/dataviz-rs/dataviz/blob/main/src/plot/axis.rs): `src/plot/axis.rs`
- [Graphics grammar](https://github.com/dataviz-rs/dataviz/blob/main/src/plot/grammar.rs): `src/plot/grammar.rs`
- [Data and tables](https://github.com/dataviz-rs/dataviz/blob/main/src/plot/data.rs): `src/plot/data.rs`

### Plot capabilities

- [Domain charts](https://github.com/dataviz-rs/dataviz/tree/main/src/plot/series): `src/plot/series`
- [Maps and geography](https://github.com/dataviz-rs/dataviz/blob/main/src/plot/geo.rs): `src/plot/geo.rs`
- [3D charts](https://github.com/dataviz-rs/dataviz/blob/main/src/plot/series/three_d.rs): `src/plot/series/three_d.rs`
- [Accessibility](https://github.com/dataviz-rs/dataviz/blob/main/src/plot/a11y.rs): `src/plot/a11y.rs`

### Rendering and output

- [Drawing scene](https://github.com/dataviz-rs/dataviz/blob/main/src/plot/scene.rs): `src/plot/scene.rs`
- [CPU rasterizer](https://github.com/dataviz-rs/dataviz/blob/main/src/plot/raster.rs): `src/plot/raster.rs`
- [GPU rasterizer](https://github.com/dataviz-rs/dataviz/blob/main/src/plot/gpu.rs): `src/plot/gpu.rs`
- [File and pixel output](https://github.com/dataviz-rs/dataviz/blob/main/src/plot/output.rs): `src/plot/output.rs`
- [Interactive HTML](https://github.com/dataviz-rs/dataviz/blob/main/src/plot/html.rs): `src/plot/html.rs`
- [Text layout](https://github.com/dataviz-rs/dataviz/blob/main/src/plot/text.rs): `src/plot/text.rs`

### Interaction and live

- [Interactive windows](https://github.com/dataviz-rs/dataviz/blob/main/src/plot/window.rs): `src/plot/window.rs`
- [Window interaction](https://github.com/dataviz-rs/dataviz/blob/main/src/plot/interact.rs): `src/plot/interact.rs`
- [Animation and live](https://github.com/dataviz-rs/dataviz/blob/main/src/plot/anim.rs): `src/plot/anim.rs`

### Other components

- **Plot users**

## Connections

- Plot users → Rust API: use library
- Plot users → Python API: use pyplot
- Plot users → JavaScript API: use browser API
- Plot users → C/C++ API: use bindings
- Plot users → MCP server: request tools
- Rust API → Figure and axes: create figures
- Python API → Figure and axes: create plots
- JavaScript API → Figure and axes: create plots
- C/C++ API → Figure and axes: create figures
- MCP server → Figure and axes: create plots
- Figure and axes → Axes and series: provide axes
- Axes and series → Axis mapping: map coordinates (evidence: `src/plot/axes.rs`)
- Axes and series → Drawing scene: draw charts (evidence: `src/plot/mod.rs`)
- Graphics grammar → Axes and series: build charts
- Data and tables → Axes and series: supply data
- Domain charts → Axes and series: provide chart types (evidence: `src/plot/series/engineering.rs`)
- Maps and geography → Axes and series: provide map charts (evidence: `src/plot/axes.rs`)
- 3D charts → Drawing scene: draw 3D scene (evidence: `src/plot/series/three_d.rs`)
- Accessibility → Figure and axes: describe charts (evidence: `src/plot/a11y.rs`)
- Drawing scene → File and pixel output: render scene (evidence: `src/plot/mod.rs`)
- File and pixel output → CPU rasterizer: rasterize pixels (evidence: `src/plot/output.rs`)
- File and pixel output → GPU rasterizer: use GPU backend (evidence: `src/plot/output.rs`)
- File and pixel output → Interactive HTML: write HTML (evidence: `src/plot/mod.rs`)
- File and pixel output → Text layout: layout text (evidence: `src/plot/output.rs`)
- Figure and axes → Interactive windows: show window
- Interactive windows → Window interaction: handle input
- Figure and axes → Animation and live: stream and animate (evidence: `src/plot/anim.rs`)
