func (h *Hist) SaveImage(f string) {
	data := plotter.Values(h.Counts)
	if h.Normalize {
		data = h.NormCounts()
	}
	p, err := plot.New()
	if err != nil {
		panic(err)
	}
	p.Title.Text = h.Title
	p.Y.Label.Text = "Count"
	if h.Normalize {
		p.Y.Label.Text = "Frequency"
	}
	bins := make([]plotter.HistogramBin, len(h.BinStart))
	for i, binStart := range h.BinStart {
		bins[i] = plotter.HistogramBin{binStart, h.BinEnd[i], data[i]}
	}
	ph := &plotter.Histogram{
		Bins:      bins,
		Width:     h.DataMax - h.DataMin,
		FillColor: plotutil.Color(2),
		LineStyle: plotter.DefaultLineStyle,
	}
	ph.LineStyle.Width = vg.Length(0.5)
	ph.Color = plotutil.Color(0)
	p.Add(ph)
	digits := strconv.Itoa(int(h.Precision))
	modeStr := fmt.Sprintf(" ApproxMode: %."+digits+"f", h.GetMode())
	info := strings.TrimRight(h.Info, "\n") + modeStr
	p.X.Label.Text = info
	if err := p.Save(11.69*vg.Inch, 8.27*vg.Inch, f); err != nil {
		panic(err)
	}
}
SaveImage saves a histogram to an image file using gonum plot.
package thist
import (
	"fmt"
	"strconv"
	"strings"
	"gonum.org/v1/plot"
	"gonum.org/v1/plot/plotter"
	"gonum.org/v1/plot/plotutil"
	"gonum.org/v1/plot/vg"
)