plot/plotter: Grid plotter adds a spurious line
when debugging the Example_logScale
output, I noticed that when changing the size of the output plot from 10x10 vg.Centimeter
to 5x5
, I got the attached figure 1).
Putting " "
as a title shows the problem better figure 2).
here is the code:
// Example_logScale shows how to create a plot with a log-scale on the Y-axis.
func Example_logScale() {
p, err := plot.New()
if err != nil {
log.Fatal(err)
}
p.Title.Text = " "
p.Y.Scale = plot.LogScale{}
p.Y.Tick.Marker = plot.LogTicks{}
p.X.Label.Text = "x"
p.Y.Label.Text = "f(x)"
f := plotter.NewFunction(math.Exp)
f.Color = color.RGBA{R: 255, A: 255}
p.Add(f, plotter.NewGrid())
p.Legend.Add("exp(x)", f)
p.X.Min = 0.1
p.X.Max = 10
p.Y.Min = math.Exp(p.X.Min)
p.Y.Max = math.Exp(p.X.Max)
err = p.Save(5*vg.Centimeter, 5*vg.Centimeter, "testdata/logscale.png")
if err != nil {
log.Panic(err)
}
}
But when setting the title to an empty string ""
, I get the figure 3).
- figure 1)
- figure 2)
- figure 3)