gplot

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2025 License: MIT Imports: 6 Imported by: 1

Documentation

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 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 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.
}

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 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳