guide

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package guide provides axis, legend, and title rendering for plots. Guides are the non-data visual elements that border the plotting area and help readers interpret the data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DrawColorBar

func DrawColorBar(cv canvas.Canvas, spec ColorBarSpec, x, y, barH float64, th theme.Theme)

DrawColorBar renders a continuous color bar legend at the given position. The bar is drawn vertically (top = max, bottom = min) as in ggplot2.

func DrawColorBarHorizontal

func DrawColorBarHorizontal(cv canvas.Canvas, spec ColorBarSpec, x, y, barW float64, th theme.Theme)

DrawColorBarHorizontal renders a horizontal continuous color bar legend.

func DrawGrid

func DrawGrid(cv canvas.Canvas, xScale, yScale scale.Scale, x, y, w, h float64, th theme.Theme)

DrawGrid renders major grid lines in the data area, first filling the panel background with the theme's Panel.Background color. Grid lines use the theme's DashPattern (nil = solid, e.g. {4,4} = dashed).

func DrawLegend

func DrawLegend(cv canvas.Canvas, title string, entries []LegendEntry, x, y float64, th theme.Theme)

DrawLegend renders a categorical legend to the right of the data area.

func DrawLegendHorizontal

func DrawLegendHorizontal(cv canvas.Canvas, title string, entries []LegendEntry, x, y, maxW float64, th theme.Theme)

DrawLegendHorizontal renders a categorical legend as a horizontal row.

func DrawXAxis

func DrawXAxis(cv canvas.Canvas, sc scale.Scale, label string, x, y, w float64, th theme.Theme)

DrawXAxis renders a horizontal axis at the bottom of the data area.

func DrawYAxis

func DrawYAxis(cv canvas.Canvas, sc scale.Scale, label string, x, y, h float64, th theme.Theme)

DrawYAxis renders a vertical axis at the left of the data area.

Types

type ColorBarSpec

type ColorBarSpec struct {
	Title string
	Cmap  colormap.Cmap
	Norm  colormap.Norm
}

ColorBarSpec describes a continuous color bar legend.

Cmap and Norm replace the previous opaque ColorFunc field: the bar walks Cmap.At directly across the [0,1] range, and Norm provides the data-space labels at the endpoints (and any future intermediate ticks).

type LegendEntry

type LegendEntry struct {
	Label string
	Color gg.RGBA
}

LegendEntry describes one item in the legend.

Jump to

Keyboard shortcuts

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