qplot

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

package qplot provides compatibility between QFrame and gonum.org/v1/plot

Index

Constants

View Source
const (
	SVG = FormatType("svg")
	PNG = FormatType("png")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BarConfig

type BarConfig func(*plot.Plot, *plotter.BarChart)

BarConfig is an optional function which configures a BarChart after creation.

type BoxPlotConfig

type BoxPlotConfig func(*plot.Plot, *plotter.BoxPlot)

BoxPlotConfig is an optional function which configures a BoxPlot after creation.

type Config

type Config struct {
	Plotters   []PlotterFunc
	Width      vg.Length
	Height     vg.Length
	Format     FormatType
	PlotConfig func(*plot.Plot)
}

Config specifies the QPlot configuration.

func NewConfig

func NewConfig(fns ...ConfigFunc) Config

NewConfig returns a new QPlot config.

type ConfigFunc

type ConfigFunc func(*Config)

ConfigFunc is a functional option for configuring QPlot.

func Format

func Format(format FormatType) ConfigFunc

Format sets the output format of the plot.

func Height

func Height(height vg.Length) ConfigFunc

Height sets the height of the plot.

func PlotConfig

func PlotConfig(fn func(*plot.Plot)) ConfigFunc

PlotConfig is an optional function which configures a plot.Plot prior to serialization.

func Plotter

func Plotter(fn PlotterFunc) ConfigFunc

Plotter appends a PlotterFunc to the plot.

func Width

func Width(width vg.Length) ConfigFunc

Width sets the width of the plot.

type FormatType

type FormatType string

FormatType indicates the output format for the plot.

type HistogramConfig

type HistogramConfig func(*plot.Plot, *plotter.Histogram)

HistogramConfig is an optional function which configures a Histogram after creation.

type LabelFunc

type LabelFunc func(i int) string

LabelFunc returns a string representation of the value in row i.

func LabelOfBool

func LabelOfBool(view qframe.BoolView) LabelFunc

LabelOfBool returns a BoolView compatible LabelFunc

func LabelOfEnum

func LabelOfEnum(view qframe.EnumView) LabelFunc

LabelOfEnum returns a EnumView compatible LabelFunc

func LabelOfFloat

func LabelOfFloat(fmt byte, view qframe.FloatView) LabelFunc

LabelOfFloat returns a FloatView compatible LabelFunc fmt determines the float format when creating a string

func LabelOfInt

func LabelOfInt(view qframe.IntView) LabelFunc

LabelOfInt returns an IntView compatible LabelFunc

func LabelOfString

func LabelOfString(view qframe.StringView) LabelFunc

LabelOfString returns a StringView compatible LabelFunc

type Labeller

type Labeller struct {
	// contains filtered or unexported fields
}

Labeller implements the Labeller interface defined in gonum.org/v1/plot/plotter. It accepts any of the predefined LabelFunc methods in this package or a custom function may be specified.

func NewLabeller

func NewLabeller(len int, fn LabelFunc) Labeller

NewLabeller returns a new Labeller

func (Labeller) Label

func (l Labeller) Label(i int) string

Label returns the label at i

type LabelsConfig

type LabelsConfig func(*plot.Plot, *plotter.Labels)

LabelsConfig is an optional function which configures a Labels after creation.

type LineConfig

type LineConfig func(*plot.Plot, *plotter.Line)

LineConfig is an optional function which configures a Line after creation.

type PlotterFunc

type PlotterFunc func(plt *plot.Plot) (plot.Plotter, error)

PlotterFunc returns a plot.Plotter.

func BarPlotter

func BarPlotter(valuer plotter.Valuer, width vg.Length, cfg BarConfig) PlotterFunc

BarPlotter returns a new PlotterFunc that plots a bar

func BoxPlot

func BoxPlot(w vg.Length, loc float64, values plotter.Valuer, cfg BoxPlotConfig) PlotterFunc

BoxPlot returns a new PlotterFunc that plots a BoxPlot.

func HistogramPlotter

func HistogramPlotter(xyer plotter.XYer, n int, cfg HistogramConfig) PlotterFunc

HistogramPlotter returns a new PlotterFunc that plots a histogram

func Labels

func Labels(labeller XYLabeller, cfg LabelsConfig) PlotterFunc

Labels returns a new PlotterFunc that plots a plotter.Labels.

func LinePlotter

func LinePlotter(xyer plotter.XYer, cfg LineConfig) PlotterFunc

LinePlotter returns a new PlotterFunc that plots a line

func PolygonPlotter

func PolygonPlotter(xyer plotter.XYer, cfg PolygonConfig) PlotterFunc

PolygonPlotter returns a new PlotterFunc that plots a polygon

func QuartPlot

func QuartPlot(loc float64, values plotter.Valuer, cfg QuartConfig) PlotterFunc

QuartPlot returns a new PlotterFunc that plots a QuartPlot.

func ScatterPlotter

func ScatterPlotter(xyer plotter.XYer, cfg ScatterConfig) PlotterFunc

ScatterPlotter returns a new PlotterFunc that plots a Scatter.

func XErrorBars

func XErrorBars(xyer XYer, xerr XErrorer, cfg XErrorBarsConfig) PlotterFunc

XErrorBars returns a new PlotterFunc that plots a XErrorBars.

func YErrorBars

func YErrorBars(xyer XYer, yerr YErrorer, cfg YErrorBarsConfig) PlotterFunc

YErrorBars returns a new PlotterFunc that plots a YErrorBars.

type PolygonConfig

type PolygonConfig func(*plot.Plot, *plotter.Polygon)

PolygonConfig is an optional function which configures a Polygon after creation.

type QPlot

type QPlot struct {
	Config
}

QPlot is a abstraction over Gonum's plotting interface for a less verbose experience in interactive environments such as Jypter notebooks.

func NewQPlot

func NewQPlot(cfg Config) QPlot

NewQPlot returns a new QPlot.

func (QPlot) Bytes

func (qp QPlot) Bytes() ([]byte, error)

Bytes returns a plot in the configured FormatType.

func (QPlot) MustBytes

func (qp QPlot) MustBytes() []byte

MustBytes returns a plot in the configured FormatType and panics if it encounters an error.

func (QPlot) WriteTo

func (qp QPlot) WriteTo(writer io.Writer) error

WriteTo writes a plot to an io.Writer

type QuartConfig

type QuartConfig func(*plot.Plot, *plotter.QuartPlot)

QuartConfig is an optional function which configures a QuartPlot after creation.

type ScatterConfig

type ScatterConfig func(*plot.Plot, *plotter.Scatter)

ScatterConfig is an optional function which configures a Scatter after creation.

type ValueFunc

type ValueFunc func(i int) float64

ValueFunc returns a float representation of the value in row i.

func MustNewValueFunc

func MustNewValueFunc(col string, qf qframe.QFrame) ValueFunc

MustNewValueFunc returns a ValueFunc and panics when an error is encountered.

func NewValueFunc

func NewValueFunc(col string, qf qframe.QFrame) (ValueFunc, error)

NewValueFunc returns a ValueFunc for column col if it is a numeric column, or returns an error.

func ValueOfFloat

func ValueOfFloat(view qframe.FloatView) ValueFunc

ValueOfFloat returns an FloatView compatible ValueFunc

func ValueOfInt

func ValueOfInt(view qframe.IntView) ValueFunc

ValueOfInt returns an IntView compatible ValueFunc

type Valuer

type Valuer struct {
	// contains filtered or unexported fields
}

Valuer implements the Valuer interface defined in gonum.org/v1/plot/plotter.Valuer

func MustNewValuer

func MustNewValuer(col string, qf qframe.QFrame) Valuer

MustNewValuer returns a new Valuer from the values in col.

func NewValuer

func NewValuer(col string, qf qframe.QFrame) (Valuer, error)

NewValuer returns a new Valuer from the values in col. The column must be a numeric type.

func (Valuer) Len

func (v Valuer) Len() int

Len returns the length of the underlying view

func (Valuer) Value

func (v Valuer) Value(i int) float64

Value returns the value in row i of the underlying view

type XErrorBarsConfig

type XErrorBarsConfig func(*plot.Plot, *plotter.XErrorBars)

XErrorBarsConfig is an optional function which configures a XErrorBars after creation.

type XErrorer

type XErrorer struct {
	// contains filtered or unexported fields
}

XErrorer implements the XErrorer interface defined in gonum.org/v1/plot/plotter

func MustNewXErrorer

func MustNewXErrorer(low, high string, qf qframe.QFrame) XErrorer

MustNewXErrorer returns a new XErrorer for the values in column low and high of the QFrame. All columns must have numeric types.

func NewXErrorer

func NewXErrorer(low, high string, qf qframe.QFrame) (XErrorer, error)

NewXErrorer returns a new XErrorer for the values in column low and high of the QFrame. All columns must have numeric types.

func (XErrorer) XError

func (xe XErrorer) XError(i int) (float64, float64)

XError returns the low and high error values in the underlying view.

type XYLabeller

type XYLabeller struct {
	Labeller
	XYer
}

XYLabeller implements the XYLabeller interface defined in gonum.org/v1/plot/plotter. It is a union of the Labeller and XYer types defined in this package.

type XYZer

type XYZer struct {
	// contains filtered or unexported fields
}

XYZer implements the XYZer interface defined in gonum.org/v1/plot/plotter

func MustNewXYZer

func MustNewXYZer(x, y, z string, qf qframe.QFrame) XYZer

MustNewXYZer returns a new XYZer from the values in column x, y, and z. All columns must have numeric types.

func NewXYZer

func NewXYZer(x, y, z string, qf qframe.QFrame) (XYZer, error)

NewXYZer returns a new XYZer from the values in column x, y, and z. All columns must have numeric types.

func (XYZer) Len

func (xyz XYZer) Len() int

Len returns the length of the underlying view

func (XYZer) XY

func (xyz XYZer) XY(i int) (float64, float64)

XY returns the values of X and Y in the underlying view

func (XYZer) XYZ

func (xyz XYZer) XYZ(i int) (float64, float64, float64)

XYZ returns the values of X, Y, and Z in the underlying view

type XYer

type XYer struct {
	// contains filtered or unexported fields
}

XYer implements the XYer interface defined in gonum.org/v1/plot/plotter.

func MustNewXYer

func MustNewXYer(x, y string, qf qframe.QFrame) XYer

MustNewXYer returns a new XYer from the values in column x and y. Both columns must have numeric types.

func NewXYer

func NewXYer(x, y string, qf qframe.QFrame) (XYer, error)

NewXYer returns a new XYer from the values in column x and y. Both columns must have numeric types.

func (XYer) Len

func (xy XYer) Len() int

Len returns the length of the underlying view

func (XYer) XY

func (xy XYer) XY(i int) (float64, float64)

XY returns the values of X and Y in the underlying view

type YErrorBarsConfig

type YErrorBarsConfig func(*plot.Plot, *plotter.YErrorBars)

YErrorBarsConfig is an optional function which configures a YErrorBars after creation.

type YErrorer

type YErrorer struct {
	// contains filtered or unexported fields
}

YErrorer implements the YErrorer interface defined in gonum.org/v1/plot/plotter

func MustNewYErrorer

func MustNewYErrorer(low, high string, qf qframe.QFrame) YErrorer

NewYErrorer returns a new YErrorer for the values in column low and high of the QFrame. All columns must have numeric types.

func NewYErrorer

func NewYErrorer(low, high string, qf qframe.QFrame) (YErrorer, error)

NewYErrorer returns a new YErrorer for the values in column low and high of the QFrame. All columns must have numeric types.

func (YErrorer) YError

func (ye YErrorer) YError(i int) (float64, float64)

YError returns the low and high error values in the underlying view.

Jump to

Keyboard shortcuts

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