thist: github.com/bsipos/thist Index | Files | Directories

package thist

import "github.com/bsipos/thist"

Index

Package Files

bar.go hist.go img.go plot.go util.go

func AutoLabel Uses

func AutoLabel(s []float64, m float64) []string

AutoLabel generates automatic labeling based on heuristics-based rounding of the values in s.

func Bar Uses

func Bar(x, y []float64, xlab, ylab []string, title string, info []string) string

Bar plots a bar plot on the terminal. It makes use of unicode characters.

func BarSimple Uses

func BarSimple(x, y []float64, xlab, ylab []string, title string, info []string) string

BarSimple plots a bar plot on the terminal. Does not use unicode charcters.

func ClearScreen Uses

func ClearScreen()

ClearScreen uses control characters to clear terminal.

func ClearScreenString Uses

func ClearScreenString() string

ClearScreenString returns the control characters to clear terminal.

func Plot Uses

func Plot(x, y []float64, xlab, ylab []string, title string, info []string, symbol, negSymbol, space, top, vbar, hbar, tvbar string) string

Plot is a general plotting function for bar plots. It is used by Bar and BarSimple.

type Hist Uses

type Hist struct {
    Title     string
    BinMode   string
    MaxBins   int
    NrBins    int
    DataCount int
    DataMap   map[float64]float64
    DataMin   float64
    DataMax   float64
    DataMean  float64
    DataSd    float64
    Normalize bool
    BinStart  []float64
    BinEnd    []float64
    Counts    []float64

    MaxPrecision float64
    Precision    float64
    BinWidth     float64
    Info         string
    // contains filtered or unexported fields
}

Hist is a struct holding the parameters and internal state of a histogram object.

func NewHist Uses

func NewHist(data []float64, title, binMode string, maxBins int, normalize bool) *Hist

NewHist initilizes a new histogram object. If data is not nil the data points are processed and the state is updated.

func (*Hist) Draw Uses

func (h *Hist) Draw() string

Draw calls Bar to draw the hsitogram to the terminal.

func (*Hist) DrawSimple Uses

func (h *Hist) DrawSimple() string

DrawSimple calls BarSimple to draw the hsitogram to the terminal.

func (*Hist) Dump Uses

func (h *Hist) Dump() string

Dump prints the bins and counts to the standard output.

func (*Hist) GetMode Uses

func (h *Hist) GetMode() float64

GetMode calculates the approximate mode of tehe dataset.

func (*Hist) NormCounts Uses

func (h *Hist) NormCounts() []float64

NormCounts returns the normalised counts for each bin.

func (*Hist) SaveImage Uses

func (h *Hist) SaveImage(f string)

SaveImage saves a histogram to an image file using gonum plot.

func (*Hist) Summary Uses

func (h *Hist) Summary() string

Summary return a string summary of the internal state of a Hist object.

func (*Hist) Update Uses

func (h *Hist) Update(p float64)

Update adds a new data point and updates internal state.

Directories

PathSynopsis
examples

Package thist imports 11 packages (graph) and is imported by 3 packages. Updated 2020-05-23. Refresh now. Tools for package owners.