The residuals plotter

A deeper look at the canvasing system will be explored later in the chapter. For now, let's return to the Plot method that satisfies the plot.Plotter interface. 

Most interesting are the following lines:

  trX, trY := p.Transforms(&c)  zero := trY(0)  lineStyle := r.LineStyle  for _, xy := range r.XYs {    x := trX(xy.X)    y := trY(xy.Y)    c.StrokeLine2(lineStyle, x, zero, x, y)  }

p.Transforms(&c) returns two functions, which will transform the coordinate of our data point to the coordinate of the backend. This way we wouldn't have to worry about the absolute location of each point. Instead, it will be treated in relation to the absolute location in the final image.

Having gotten the transformation functions, we then loop through ...

Get Go Machine Learning Projects 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.