diff --git a/plotter/field.go b/plotter/field.go index ed2b60a2..34a47e32 100644 --- a/plotter/field.go +++ b/plotter/field.go @@ -18,11 +18,11 @@ type FieldXY interface { // Dims returns the dimensions of the grid. Dims() (c, r int) - // Vector returns the value of a grid value at (c, r). - // It will panic if c or r are out of bounds for the grid. + // Vector returns the value of a vector field at (c, r). + // It will panic if c or r are out of bounds for the field. Vector(c, r int) XY - // X returns the coordinate for the column at the index x. + // X returns the coordinate for the column at the index c. // It will panic if c is out of bounds for the grid. X(c int) float64 @@ -52,8 +52,7 @@ type Field struct { max float64 } -// NewField creates as new heat map plotter for the given data, -// using the provided palette. +// NewField creates a new vector field plotter. func NewField(f FieldXY) *Field { max := math.Inf(-1) c, r := f.Dims() diff --git a/plotter/field_test.go b/plotter/field_test.go index da02c939..0e42b65e 100644 --- a/plotter/field_test.go +++ b/plotter/field_test.go @@ -27,13 +27,13 @@ func (f field) Dims() (c, r int) { return f.c, f.r } func (f field) Vector(c, r int) plotter.XY { return f.fn(f.X(c), f.Y(r)) } func (f field) X(c int) float64 { if c < 0 || c >= f.c { - panic("index out of range") + panic("column index out of range") } return float64(c - f.c/2) } func (f field) Y(r int) float64 { if r < 0 || r >= f.r { - panic("index out of range") + panic("row index out of range") } return float64(r - f.r/2) }