MCPcopy Index your code
hub / github.com/gonum/plot / Plot

Method Plot

plotter/grid.go:43–81  ·  view source on GitHub ↗

Plot implements the plot.Plotter interface.

(c draw.Canvas, plt *plot.Plot)

Source from the content-addressed store, hash-verified

41
42// Plot implements the plot.Plotter interface.
43func (g *Grid) Plot(c draw.Canvas, plt *plot.Plot) {
44 trX, trY := plt.Transforms(&c)
45
46 var (
47 ymin = c.Min.Y
48 ymax = c.Max.Y
49 xmin = c.Min.X
50 xmax = c.Max.X
51 )
52
53 if g.Vertical.Color == nil {
54 goto horiz
55 }
56 for _, tk := range plt.X.Tick.Marker.Ticks(plt.X.Min, plt.X.Max) {
57 if tk.IsMinor() {
58 continue
59 }
60 x := trX(tk.Value)
61 if x > xmax || x < xmin {
62 continue
63 }
64 c.StrokeLine2(g.Vertical, x, ymin, x, ymax)
65 }
66
67horiz:
68 if g.Horizontal.Color == nil {
69 return
70 }
71 for _, tk := range plt.Y.Tick.Marker.Ticks(plt.Y.Min, plt.Y.Max) {
72 if tk.IsMinor() {
73 continue
74 }
75 y := trY(tk.Value)
76 if y > ymax || y < ymin {
77 continue
78 }
79 c.StrokeLine2(g.Horizontal, xmin, y, xmax, y)
80 }
81}

Callers

nothing calls this directly

Calls 4

TransformsMethod · 0.80
IsMinorMethod · 0.80
StrokeLine2Method · 0.80
TicksMethod · 0.65

Tested by

no test coverage detected