Documentation
¶
Overview ¶
Package plot provides plotting primitives that facilitate the construction of simple plots.
Index ¶
- type Canvas
- func (c *Canvas) AddAxis(ticks []int, thick int, position string) error
- func (c *Canvas) AddLabel(x, y int, label string, col *color.RGBA)
- func (c *Canvas) At(x, y int) color.Color
- func (c *Canvas) Bounds() image.Rectangle
- func (c *Canvas) ColorModel() color.Model
- func (c *Canvas) EncodePNG(w io.Writer) error
- func (c *Canvas) Line(x0, y0, x1, y1, thick int, col *color.RGBA) error
- func (c *Canvas) Rectangle(x0, y0, x1, y1, thick int, out *color.RGBA)
- func (c *Canvas) SaveToFile(name string) error
- func (c *Canvas) Set(x, y int, col color.Color)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Canvas ¶
Canvas is the basis for all other drawing primitives. Its only properties are a width, a height and a background color. Canvas is based on `image.RGBA'.
func (*Canvas) AddAxis ¶
AddAxis adds an axis to a `Canvas' in either horizontal or vertical position.
func (*Canvas) AddLabel ¶
AddLabel adds a `label' at a certain `x' and `y' position of a `Canvas'. Currently, only a fixed-size font is implemented (`basicfont.Face7x13').
func (*Canvas) ColorModel ¶
ColorModel ensures that `Canvas' implements `image.Image'
func (*Canvas) EncodePNG ¶
EncodePNG encodes a `Canvas' and everything that is drawn on it as a .png using an `io.Writer'.
func (*Canvas) Line ¶
Line draws a straight line on a `Canvas'. The line will be drawn from (`x0', `y0') to (`x1', `y1') with a certain thickness in pixels and a certain color.
func (*Canvas) Rectangle ¶
Rectangle creates a rectangle with a certain outline color between points (`x0', `y0') and (`x1', `y1') on a `Canvas'. Thickness `thick' can be specified as well.
func (*Canvas) SaveToFile ¶
SaveToFile saves a `Canvas' to a file at `path'. The file does not need to exist (if it does, it will be overwritten).