grammar

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: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AesMap

type AesMap map[string]string

AesMap maps aesthetic channel names to column names.

func ToAesMap

func ToAesMap(mappings []aes.Mapping) AesMap

ToAesMap converts a slice of aes.Mapping into an AesMap.

func (AesMap) Merge

func (a AesMap) Merge(other AesMap) AesMap

Merge returns a new AesMap with entries from other as base, overridden by entries from the receiver (a takes priority).

type CompiledLayer

type CompiledLayer struct {
	Geom    geom.Layer
	Mapping AesMap          // fully merged mapping (global + layer)
	Data    dataset.Dataset // post-stat dataset (may differ from panel dataset)
}

CompiledLayer is a fully resolved layer ready for drawing.

type Labels

type Labels struct {
	Title    string
	Subtitle string
	X        string
	Y        string
	Caption  string
}

Labels holds all text annotations for a plot.

type LayerSpec

type LayerSpec struct {
	Geom    geom.Layer
	Mapping AesMap // per-layer aesthetic overrides
}

LayerSpec describes a single visual layer in the plot.

type PanelPlan

type PanelPlan struct {
	Label   string
	Dataset dataset.Dataset
	Layers  []CompiledLayer
}

PanelPlan describes a single panel (facet sub-plot) in the render plan.

type PlotSpec

type PlotSpec struct {
	// Dataset is the primary data source.
	Dataset dataset.Dataset

	// GlobalMapping maps aesthetic channels to column names at the plot level.
	// Per-layer mappings override these.
	GlobalMapping AesMap

	// Layers describes each visual layer (geom + stat + position + local aes).
	Layers []LayerSpec

	// ScaleOverrides holds user-specified scale configurations, keyed by
	// aesthetic channel ("x", "y", "color", etc.).
	ScaleOverrides map[string]ScaleOverride

	// ColorScales holds user-specified color/fill scales, keyed by
	// aesthetic channel ("color" or "fill"). nil entries fall back to
	// the auto-detected default ([colormap.Viridis] for continuous data,
	// [colormap.Tab10] for discrete data).
	ColorScales map[string]*colormap.Scale

	// Coord defines the coordinate system (default: Cartesian).
	Coord coord.Coord

	// Facet defines the faceting strategy (default: None).
	Facet facet.Facet

	// Theme holds the theme name or configuration.
	ThemeName theme.Name

	// Labels holds plot title, subtitle, axis labels, caption.
	Labels Labels

	// XLim and YLim hold optional user-specified axis limits.
	// nil means auto-detect from data.
	XLim [2]*float64
	YLim [2]*float64

	// LegendPosition controls where the legend is drawn.
	LegendPosition string
}

PlotSpec is the fully declarative specification of a plot, produced by the user-facing builder API and consumed by the compilation pipeline.

type RenderPlan

type RenderPlan struct {
	// Panels contains the list of facet panels to render, each with its
	// own dataset and compiled layers.
	Panels []PanelPlan

	// TrainedScales maps aesthetic channels to their trained scale state.
	TrainedScales map[string]TrainedScale

	// Labels holds resolved plot labels.
	Labels Labels

	// ThemeName is the resolved theme.
	ThemeName string
}

RenderPlan is the output of the compilation pipeline — a fully resolved, validated plot specification ready for rendering.

type ScaleOverride

type ScaleOverride struct {
	Type   scale.Type        // e.g., scale.Log10, scale.Sqrt, scale.Reverse
	Params map[string]string // type-specific parameters
}

ScaleOverride captures a user-requested scale for a specific aesthetic channel.

type TrainedScale

type TrainedScale struct {
	Channel  string
	Type     string // "continuous", "discrete", "temporal"
	Min, Max float64
	Domain   []string // for discrete scales
}

TrainedScale holds the trained domain of a scale for an aesthetic channel.

Jump to

Keyboard shortcuts

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