Plotting data

It is now time to plot the results and the dataset in order to test how accurate the results from the linear regression technique are. For that purpose, we are going to use the Go code of plotLR.go, which will be presented in four parts. plotLR.go requires three command-line arguments, which are a and b from the y = a x + b formula, and the file that contains the data points. The fact that plotLR.go does not calculate a and b on its own gives you the opportunity to experiment with a and b using your own values or values that were calculated by another utility.

The first part of plotLR.go is as follows:

package main import ( "encoding/csv" "flag" "fmt" "" "" "" "image/color" ...

Get Mastering Go - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.