myplot

package module
v0.0.0-...-a8b82f5 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2017 License: BSD-3-Clause Imports: 8 Imported by: 5

README

plot

Additional plot routines for plotinum. If you'd like to use any, please fork.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdjustHue

func AdjustHue(msh *MSHFloat, unsatM float64) (h float64)

func AngleDiff

func AngleDiff(a, b float64) float64

Given two angular orientations, returns the smallest angle between the two.

func BoundedNormalize

func BoundedNormalize(val, min, max float64) (norm float64)

Transform a value to an interval between 0 and 1

func GroupPlot

func GroupPlot(p []PlotAssigner)

Types

type ColoredScatter

type ColoredScatter struct {
	plotter.XYZs
	draw.GlyphStyle
	Colormapper
	// contains filtered or unexported fields
}

coloredscatter implements the Plotter interface, drawing a bubble plot of x, y, z triples where the z value determines the color of the dot.

func NewColoredScatter

func NewColoredScatter(xyzs plotter.XYZer) (*ColoredScatter, error)

NewColoredScatter returns a ColoredScatter that uses the default glyph style and colormap.

func (*ColoredScatter) DataRange

func (c *ColoredScatter) DataRange() (xmin, xmax, ymin, ymax float64)

DataRange implements the DataRange method of the plot.DataRanger interface.

func (*ColoredScatter) Max

func (c *ColoredScatter) Max() float64

func (*ColoredScatter) Min

func (c *ColoredScatter) Min() float64

func (*ColoredScatter) Plot

func (c *ColoredScatter) Plot(da draw.Canvas, plt *plot.Plot)

func (c *ColoredScatter) Plot(da plot.DrawArea, plt *plot.Plot) {

func (*ColoredScatter) SetColormap

func (c *ColoredScatter) SetColormap(m Colormapper)

func (*ColoredScatter) SetMax

func (c *ColoredScatter) SetMax(max float64)

func (*ColoredScatter) SetMin

func (c *ColoredScatter) SetMin(min float64)

func (*ColoredScatter) SetScale

func (c *ColoredScatter) SetScale(min, max float64)

type Colormapper

type Colormapper interface {
	Colormap(float64) color.Color
}

Maps a value to a color

type Diverging

type Diverging struct {
	Low  *MSHFloat // Low valued color
	High *MSHFloat // High valued color
	// contains filtered or unexported fields
}

func BlueRed

func BlueRed() *Diverging

func (*Diverging) Colormap

func (d *Diverging) Colormap(v float64) color.Color

func (*Diverging) ResetMidpoint

func (d *Diverging) ResetMidpoint()

func (*Diverging) SetColors

func (d *Diverging) SetColors(low, high color.Color)

func (*Diverging) SetMidpoint

func (d *Diverging) SetMidpoint(mid float64)

func (*Diverging) SetScale

func (d *Diverging) SetScale(min, max float64)

Set the min and max values for the scale

type Grayscale

type Grayscale struct {
	Inverted bool // Flip the direction of the maximum
	// contains filtered or unexported fields
}

Linearly maps the colors between light gray and black

func (*Grayscale) Colormap

func (c *Grayscale) Colormap(z float64) color.Color

func (*Grayscale) Scale

func (c *Grayscale) Scale() (float64, float64)

func (*Grayscale) SetMax

func (c *Grayscale) SetMax(val float64)

func (*Grayscale) SetMin

func (c *Grayscale) SetMin(val float64)

func (*Grayscale) SetScale

func (c *Grayscale) SetScale(min, max float64)

type GridMat

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

func NewGridMat

func NewGridMat(x, y []float64, z *mat.Dense) GridMat

func (GridMat) Dims

func (g GridMat) Dims() (c, r int)

func (GridMat) X

func (g GridMat) X(c int) float64

func (GridMat) Y

func (g GridMat) Y(r int) float64

func (GridMat) Z

func (g GridMat) Z(c, r int) float64

type Jet

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

Implementation of the jet colormap

func (*Jet) Colormap

func (c *Jet) Colormap(z float64) color.Color

func (*Jet) Scale

func (c *Jet) Scale() (float64, float64)

func (*Jet) SetMax

func (c *Jet) SetMax(val float64)

func (*Jet) SetMin

func (c *Jet) SetMin(val float64)

func (*Jet) SetScale

func (c *Jet) SetScale(min, max float64)

type LabFloat

type LabFloat struct {
	L, A, B, Alpha float64
}

func NewLabFloat

func NewLabFloat(c color.Color) *LabFloat

func (*LabFloat) MSH

func (lab *LabFloat) MSH() *MSHFloat

func (*LabFloat) RGB

func (lab *LabFloat) RGB() *RGBFloat

func (*LabFloat) RGBA

func (lab *LabFloat) RGBA() (r, g, b, a uint32)

func (*LabFloat) XYZ

func (lab *LabFloat) XYZ() *XYZFloat

type MSHFloat

type MSHFloat struct {
	M, S, H, Alpha float64
}

func NewMSHFloat

func NewMSHFloat(c color.Color) *MSHFloat

func (*MSHFloat) Lab

func (m *MSHFloat) Lab() *LabFloat

func (*MSHFloat) RGB

func (m *MSHFloat) RGB() *RGBFloat

func (*MSHFloat) RGBA

func (m *MSHFloat) RGBA() (r, g, b, a uint32)

type PlotAssigner

type PlotAssigner interface {
	Plot() (plotName, lineName string, pt struct{ X, Y float64 })
}

type RGBFloat

type RGBFloat struct {
	R, G, B, Alpha float64
}

Comes from matlab, so RGB need to be between 0 and 1

func NewRGBFloat

func NewRGBFloat(c color.Color) *RGBFloat

func (*RGBFloat) Lab

func (rgb *RGBFloat) Lab() *LabFloat

func (*RGBFloat) MSH

func (rgb *RGBFloat) MSH() *MSHFloat

func (*RGBFloat) RGBA

func (rgb *RGBFloat) RGBA() (r, g, b, a uint32)

func (*RGBFloat) XYZ

func (rgb *RGBFloat) XYZ() *XYZFloat

Converts RGB to XYZ Note from original author: The following performs a "gamma correction" specified by the sRGB color space. sRGB is defined by a canonical definition of a display monitor and has been standardized by the International Electrotechnical Commission (IEC 61966-2-1). The nonlinearity of the correction is designed to make the colors more perceptually uniform. This color space has been adopted by several applications including Adobe Photoshop and Microsoft Windows color management. OpenGL is agnostic on its RGB color space, but it is reasonable to assume it is close to this one.

type ScaledColormapper

type ScaledColormapper interface {
	Colormapper
	SetScale(min float64, max float64)
}

Maps a value in [0,1] to a color

type Uniform

type Uniform struct {
	Value color.Color
}

Single Color is a colormap which returns a single color regardless of the value of the input

func (*Uniform) Colormap

func (s *Uniform) Colormap(v float64) color.Color

Returns the color present in the struct

type VecXY

type VecXY struct {
	X []float64
	Y []float64
}

func (VecXY) Len

func (v VecXY) Len() int

func (VecXY) XY

func (v VecXY) XY(i int) (x, y float64)

type VecXYZ

type VecXYZ struct {
	X []float64
	Y []float64
	Z []float64
}

func (VecXYZ) Len

func (v VecXYZ) Len() int

func (VecXYZ) XYZ

func (v VecXYZ) XYZ(i int) (x, y, z float64)

type XYSorter

type XYSorter struct {
	plotter.XYs
}

Sorts by lower to higher x

func (XYSorter) Len

func (xy XYSorter) Len() int

func (XYSorter) Less

func (xy XYSorter) Less(i, j int) bool

func (XYSorter) Swap

func (xy XYSorter) Swap(i, j int)

type XYZFloat

type XYZFloat struct {
	X, Y, Z, Alpha float64
}

func NewXYZFloat

func NewXYZFloat(c color.Color) *XYZFloat

func (*XYZFloat) Lab

func (xyz *XYZFloat) Lab() *LabFloat

func (*XYZFloat) RGB

func (xyz *XYZFloat) RGB() *RGBFloat

func (*XYZFloat) RGBA

func (xyz *XYZFloat) RGBA() (r, g, b, a uint32)

Jump to

Keyboard shortcuts

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