Now let's look at how the data for the house prices are distributed:
func hist(a []float64) (*plot.Plot, error){ h, err := plotter.NewHist(plotter.Values(a), 10) if err != nil { return nil, err } p, err := plot.New() if err != nil { return nil, err } h.Normalize(1) p.Add(h) return p, nil}
This section is added to the main function:
hist, err := plotHist(YsBack)mHandleErr(err)hist.Title.Text = "Histogram of House Prices"mHandleErr(hist.Save(25*vg.Centimeter, 25*vg.Centimeter, "hist.png"))
The following diagram is:
As can be noted, the histogram of the prices is a little skewed. Fortunately, we can fix that by ...