Help us shape the future of Go! Take the 2026 Go Developer Survey

plot

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package plot renders pure-text charts (histograms, scatter plots) for the UI. Functions here take an area and a theme and return a styled string; they never import bubbletea and hold no state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderHistogram

func RenderHistogram(values []float64, buckets int, w, h int, th *theme.Theme) string

RenderHistogram draws a horizontal-bar histogram of values into a string no wider than w. One line per bucket: right-aligned bucket range, a bar of block runes proportional to the bucket count, and the count itself. The caller is expected to scroll vertically when the result has more lines than h; the renderer never truncates buckets.

NaN/Inf values are skipped. With no usable values a friendly message is returned. buckets is clamped to 1..50; a single distinct value collapses to one bucket.

func RenderScatter

func RenderScatter(xs, ys []float64, groups []string, w, h int, th *theme.Theme) string

RenderScatter draws an x/y scatter plot on a braille-dot canvas (2x4 dots per character cell) sized to fit within w x h, including y-axis labels on the left, an x-axis label line at the bottom and, when groups is non-nil, a legend line mapping each distinct group to its series color.

Points with NaN/Inf on either axis are skipped; groups (when non-nil) is indexed alongside xs/ys. Empty input and constant axes are handled.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL