gplot

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2026 License: MIT Imports: 8 Imported by: 1

Documentation

Overview

`gplot` package provides functions for data visualization using gonum/plot.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateBarChart

func CreateBarChart(config BarChartConfig) *plot.Plot

CreateBarChart generates and returns a plot.Plot object based on BarChartConfig.

func CreateFunctionPlot added in v0.0.12

func CreateFunctionPlot(config FunctionPlotConfig) *plot.Plot

CreateFunctionPlot generates and returns a plot.Plot object based on FunctionPlotConfig.

func CreateHeatmapChart added in v0.2.6

func CreateHeatmapChart(config HeatmapChartConfig) *plot.Plot

CreateHeatmapChart generates and returns a plot.Plot object based on HeatmapChartConfig.

func CreateHistogram

func CreateHistogram(config HistogramConfig) *plot.Plot

CreateHistogram generates and returns a plot.Plot object based on HistogramConfig.

func CreateLineChart added in v0.0.11

func CreateLineChart(config LineChartConfig) *plot.Plot

CreateLineChart generates and returns a plot.Plot object based on LineChartConfig.

func CreateScatterPlot added in v0.2.6

func CreateScatterPlot(config ScatterPlotConfig) *plot.Plot

CreateScatterPlot generates and returns a plot.Plot object based on ScatterPlotConfig.

func CreateStepChart added in v0.2.6

func CreateStepChart(config StepChartConfig) *plot.Plot

CreateStepChart generates and returns a plot.Plot object based on StepChartConfig.

func SaveChart

func SaveChart(plt *plot.Plot, filename string)

SaveChart saves the plot to a file. Supported file formats: .jpg|.jpeg|.pdf|.png|.svg|.tex|.tif|.tiff Automatically determine the file extension based on the filename.

Types

type BarChartConfig

type BarChartConfig struct {
	Title     string    // Title of the chart.
	XAxis     []string  // X-axis data (categories).
	Data      any       // Accepts []float64 or *insyra.DataList
	XAxisName string    // Optional: X-axis name.
	YAxisName string    // Optional: Y-axis name.
	BarWidth  float64   // Optional: Bar width for each bar in the chart. Default is 20.
	ErrorBars []float64 // Optional: Error bar values for each bar. If provided, must match the length of Data.
}

BarChartConfig defines the configuration for a single series bar chart.

type FunctionPlotConfig added in v0.0.12

type FunctionPlotConfig struct {
	Title     string                  // Title of the chart.
	XAxisName string                  // Label for the X-axis.
	YAxisName string                  // Label for the Y-axis.
	Func      func(x float64) float64 // The mathematical function to plot.
	XMin      float64                 // Minimum value of X (optional).
	XMax      float64                 // Maximum value of X (optional).
	YMin      float64                 // Minimum value of Y (optional).
	YMax      float64                 // Maximum value of Y (optional).
}

FunctionPlotConfig defines the configuration for a function plot.

type HeatmapChartConfig added in v0.2.6

type HeatmapChartConfig struct {
	Title     string    // Title of the chart.
	XAxisName string    // Optional: X-axis name.
	YAxisName string    // Optional: Y-axis name.
	Data      any       // Accepts [][]float64 or *insyra.DataTable
	XAxis     []float64 // Optional: X-axis coordinates. If not provided, will use indices.
	YAxis     []float64 // Optional: Y-axis coordinates. If not provided, will use indices.
	Colors    int       // Optional: Number of colors in the palette. Default is 20.
	Alpha     float64   // Optional: Alpha (transparency) for colors. Default is 1.0.
}

HeatmapChartConfig defines the configuration for a heatmap chart.

type HistogramConfig

type HistogramConfig struct {
	Title     string // Title of the chart.
	Data      any    // Accepts []float64 or *insyra.DataList or insyra.IDataList.
	XAxisName string // Optional: X-axis name.
	YAxisName string // Optional: Y-axis name.
	Bins      int    // Number of bins for the histogram.
}

HistogramConfig defines the configuration for a single series histogram.

type LineChartConfig added in v0.0.11

type LineChartConfig struct {
	Title     string    // Title of the chart.
	XAxis     []float64 // X-axis data.
	Data      any       // Supports map[string][]float64 or []*insyra.DataList.
	XAxisName string    // Optional: X-axis name.
	YAxisName string    // Optional: Y-axis name.
}

LineChartConfig defines the configuration for a multi-series line chart.

type ScatterPlotConfig added in v0.2.6

type ScatterPlotConfig struct {
	Title     string // Title of the chart.
	Data      any    // Supports map[string][][]float64, []*insyra.DataList, or []insyra.IDataList.
	XAxisName string // Optional: X-axis name.
	YAxisName string // Optional: Y-axis name.
}

ScatterPlotConfig defines the configuration for a multi-series scatter plot.

type StepChartConfig added in v0.2.6

type StepChartConfig struct {
	Title     string    // Title of the chart.
	XAxis     []float64 // X-axis data.
	Data      any       // Supports map[string][]float64 or []*insyra.DataList.
	XAxisName string    // Optional: X-axis name.
	YAxisName string    // Optional: Y-axis name.
	StepStyle string    // Optional: Step style - "pre", "mid", "post". Default is "post".
}

StepChartConfig defines the configuration for a multi-series step chart.

Jump to

Keyboard shortcuts

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