A primer on Gonum plots

Before we go further, I think it might be worth it to have an understanding of Gonum's plotting library in general. We've so far been using Gonum's plot library in rather ad hoc ways. This was to familiarize you with how to use the library. Now that you're somewhat familiar, it's time to learn more about the internals in order to plot better in the future.

A *plot.Plot object holds the metadata of a plot. A plot consists of the following features:

  • A title
  • X and Y axes
  • A legend
  • A list of plot.Plotter

A plot.Plotter interface is simply anything that can take a *plot.Plot object and draw it on to draw.Canvas, defined as follows:

type Plotter interface { Plot(draw.Canvas, *Plot)}

By separating the notions of a plot

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.