func NewHistogram(xy XYer, n int) (*Histogram, error) {
	if n <= 0 {
		return nil, errors.New("Histogram with non-positive number of bins")
	}
	bins, width := binPoints(xy, n)
	return &Histogram{
		Bins:      bins,
		Width:     width,
		FillColor: color.Gray{128},
		LineStyle: DefaultLineStyle,
	}, nil
}
NewHistogram returns a new histogram
that represents the distribution of values
using the given number of bins.

Each y value is assumed to be the frequency
count for the corresponding x.

If the number of bins is non-positive than
a reasonable default is used.
package plotter
import (
	"errors"
	"fmt"
	"image/color"
	"math"
	"gonum.org/v1/plot"
	"gonum.org/v1/plot/vg"
	"gonum.org/v1/plot/vg/draw"
)
type Histogram struct {
	Bins []HistogramBin
	Width float64
	FillColor color.Color
	draw.LineStyle
	LogY bool
}