# adynascimento/plot architecture

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

- Interactive diagram: https://gitdiagram.com/adynascimento/plot
- Repository: https://github.com/adynascimento/plot

## Overview

Plot is a Go visualization wrapper with a Matplotlib-style API. The main workflow is to create a figure, add one or more visualizations and configure them, then render and save or show the result; animation and subplot composition extend that workflow. The graph preserves the README’s major visualization and customization capabilities. Sampled source supports the shared plot state, rendering, and several plot implementations; edges for documented but unsampled features rely on README statements.

Main entry points: [`plotter/plotter.go`](https://github.com/adynascimento/plot/blob/master/plotter/plotter.go) (Plot API), [`plotter/models.go`](https://github.com/adynascimento/plot/blob/master/plotter/models.go) (Plot state), [`plotter/scatter.go`](https://github.com/adynascimento/plot/blob/master/plotter/scatter.go) (Scatter plots), [`plotter/contour.go`](https://github.com/adynascimento/plot/blob/master/plotter/contour.go) (Contour plots)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Plot API"]
  node_plot_api["Plot API<br/>[plotter.go]"]
  node_state["Plot state<br/>[models.go]"]
end

subgraph group_visuals["Visualizations"]
  node_line["Line plots<br/>[line.go]"]
  node_scatter["Scatter plots<br/>[scatter.go]"]
  node_histogram["Histograms<br/>[histogram.go]"]
  node_contour["Contour plots<br/>[contour.go]"]
  node_image["Image display<br/>[plotter.go]"]
  node_subplot["Subplots<br/>[subplotter.go]"]
  node_animation["Animations<br/>[animation.go]"]
end

subgraph group_styling["Styling and composition"]
  node_colormaps["Colormaps<br/>[colormap.go]"]
  node_colorbar["Colorbars<br/>[colorbar.go]"]
  node_legend["Legends<br/>[legend.go]"]
end

subgraph group_output["Rendering and output"]
  node_render["Figure rendering<br/>[plotter.go]"]
  node_file_output["PNG and GIF output<br/>[plotter.go]"]
  node_window["Window display<br/>[plotter.go]"]
end

node_user(("Go caller"))
node_gonum["Gonum Plot"]
node_gio["Gio windowing"]

node_user -->|"creates figure"| node_plot_api
node_plot_api -->|"adds lines"| node_line
node_plot_api -->|"adds points"| node_scatter
node_plot_api -->|"adds distribution"| node_histogram
node_plot_api -->|"adds contours"| node_contour
node_plot_api -->|"adds image"| node_image
node_plot_api -->|"creates layout"| node_subplot
node_plot_api -->|"configures frames"| node_animation
node_line -->|"updates plot state"| node_state
node_scatter -->|"adds plotter"| node_state
node_histogram -->|"adds histogram"| node_state
node_contour -->|"adds contours"| node_state
node_image -->|"adds image"| node_state
node_plot_api -->|"maintains figure"| node_state
node_scatter -->|"colors points"| node_colormaps
node_contour -->|"colors levels"| node_colormaps
node_scatter -->|"configures scale bar"| node_colorbar
node_contour -->|"configures scale bar"| node_colorbar
node_plot_api -->|"configures legend"| node_legend
node_subplot -->|"composes plots"| node_render
node_plot_api -->|"draws figure"| node_render
node_render -->|"draws plot"| node_gonum
node_plot_api -->|"saves figure"| node_file_output
node_animation -->|"encodes GIF"| node_file_output
node_plot_api -->|"shows figure"| node_window
node_window -->|"opens window"| node_gio
node_animation -->|"renders frames"| node_render

click node_plot_api "https://github.com/adynascimento/plot/blob/master/plotter/plotter.go"
click node_line "https://github.com/adynascimento/plot/blob/master/plotter/line.go"
click node_scatter "https://github.com/adynascimento/plot/blob/master/plotter/scatter.go"
click node_histogram "https://github.com/adynascimento/plot/blob/master/plotter/histogram.go"
click node_contour "https://github.com/adynascimento/plot/blob/master/plotter/contour.go"
click node_image "https://github.com/adynascimento/plot/blob/master/plotter/plotter.go"
click node_colormaps "https://github.com/adynascimento/plot/blob/master/plotter/colormap.go"
click node_colorbar "https://github.com/adynascimento/plot/blob/master/plotter/colorbar.go"
click node_legend "https://github.com/adynascimento/plot/blob/master/plotter/legend.go"
click node_subplot "https://github.com/adynascimento/plot/blob/master/plotter/subplotter.go"
click node_animation "https://github.com/adynascimento/plot/blob/master/plotter/animation.go"
click node_state "https://github.com/adynascimento/plot/blob/master/plotter/models.go"
click node_render "https://github.com/adynascimento/plot/blob/master/plotter/plotter.go"
click node_file_output "https://github.com/adynascimento/plot/blob/master/plotter/plotter.go"
click node_window "https://github.com/adynascimento/plot/blob/master/plotter/plotter.go"

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_plot_api,node_state toneBlue
class node_line,node_scatter,node_histogram,node_contour,node_image,node_subplot,node_animation toneAmber
class node_colormaps,node_colorbar,node_legend toneMint
class node_render,node_file_output,node_window toneRose
class node_user,node_gonum,node_gio toneIndigo
```

## Components

### Plot API

- [Plot API](https://github.com/adynascimento/plot/blob/master/plotter/plotter.go): `plotter/plotter.go`
- [Plot state](https://github.com/adynascimento/plot/blob/master/plotter/models.go): `plotter/models.go`

### Visualizations

- [Line plots](https://github.com/adynascimento/plot/blob/master/plotter/line.go): `plotter/line.go`
- [Scatter plots](https://github.com/adynascimento/plot/blob/master/plotter/scatter.go): `plotter/scatter.go`
- [Histograms](https://github.com/adynascimento/plot/blob/master/plotter/histogram.go): `plotter/histogram.go`
- [Contour plots](https://github.com/adynascimento/plot/blob/master/plotter/contour.go): `plotter/contour.go`
- [Image display](https://github.com/adynascimento/plot/blob/master/plotter/plotter.go): `plotter/plotter.go`
- [Subplots](https://github.com/adynascimento/plot/blob/master/plotter/subplotter.go): `plotter/subplotter.go`
- [Animations](https://github.com/adynascimento/plot/blob/master/plotter/animation.go): `plotter/animation.go`

### Styling and composition

- [Colormaps](https://github.com/adynascimento/plot/blob/master/plotter/colormap.go): `plotter/colormap.go`
- [Colorbars](https://github.com/adynascimento/plot/blob/master/plotter/colorbar.go): `plotter/colorbar.go`
- [Legends](https://github.com/adynascimento/plot/blob/master/plotter/legend.go): `plotter/legend.go`

### Rendering and output

- [Figure rendering](https://github.com/adynascimento/plot/blob/master/plotter/plotter.go): `plotter/plotter.go`
- [PNG and GIF output](https://github.com/adynascimento/plot/blob/master/plotter/plotter.go): `plotter/plotter.go`
- [Window display](https://github.com/adynascimento/plot/blob/master/plotter/plotter.go): `plotter/plotter.go`

### Other components

- **Go caller**
- **Gonum Plot**
- **Gio windowing**

## Connections

- Go caller → Plot API: creates figure (evidence: `README.md`)
- Plot API → Line plots: adds lines (evidence: `README.md`)
- Plot API → Scatter plots: adds points (evidence: `README.md`)
- Plot API → Histograms: adds distribution (evidence: `README.md`)
- Plot API → Contour plots: adds contours (evidence: `README.md`)
- Plot API → Image display: adds image (evidence: `README.md`)
- Plot API → Subplots: creates layout (evidence: `README.md`)
- Plot API → Animations: configures frames (evidence: `README.md`)
- Line plots → Plot state: updates plot state (evidence: `plotter/line.go`)
- Scatter plots → Plot state: adds plotter (evidence: `plotter/scatter.go`)
- Histograms → Plot state: adds histogram (evidence: `plotter/histogram.go`)
- Contour plots → Plot state: adds contours (evidence: `plotter/contour.go`)
- Image display → Plot state: adds image (evidence: `plotter/plotter.go`)
- Plot API → Plot state: maintains figure (evidence: `plotter/plotter.go`)
- Scatter plots → Colormaps: colors points (evidence: `plotter/scatter.go`)
- Contour plots → Colormaps: colors levels (evidence: `plotter/contour.go`)
- Scatter plots → Colorbars: configures scale bar (evidence: `plotter/scatter.go`)
- Contour plots → Colorbars: configures scale bar (evidence: `plotter/contour.go`)
- Plot API → Legends: configures legend (evidence: `README.md`)
- Subplots → Figure rendering: composes plots (evidence: `plotter/subplotter.go`)
- Plot API → Figure rendering: draws figure (evidence: `plotter/plotter.go`)
- Figure rendering → Gonum Plot: draws plot (evidence: `plotter/plotter.go`)
- Plot API → PNG and GIF output: saves figure (evidence: `plotter/plotter.go`)
- Animations → PNG and GIF output: encodes GIF (evidence: `plotter/animation.go`)
- Plot API → Window display: shows figure (evidence: `plotter/plotter.go`)
- Window display → Gio windowing: opens window (evidence: `plotter/plotter.go`)
- Animations → Figure rendering: renders frames (evidence: `plotter/animation.go`)
