plot: Y-range value display bug
running the following program:
package main
import (
"flag"
"log"
"github.com/gonum/plot"
"github.com/gonum/plot/plotter"
"github.com/gonum/plot/vg"
)
func main() {
v := flag.Float64("v", 1300, "y-value")
flag.Parse()
p, err := plot.New()
if err != nil {
log.Fatal(err)
}
p.Y.Label.Text = "RPMs"
var data = make(plotter.XYs, 10)
for i := range data {
data[i].X = float64(i)
data[i].Y = *v
}
lines, points, err := plotter.NewLinePoints(data)
if err != nil {
log.Fatal(err)
}
p.Add(points, lines)
p.Add(plotter.NewGrid())
err = p.Save(10*vg.Centimeter, 10*vg.Centimeter, "foo.png")
if err != nil {
log.Fatal(err)
}
}
ie: while the data line is at the correct location, the Y-axis labels are wrong (1300 is repeated twice, 1301 and 1299 aren't probably consistent).
this doesn't occur when I run with, say, 1401
or 130
as a value, but this bug also occurs for 1201
, 1400
and 1501
.
I suspect an issue in the rounding+formatting of the axis labels.