MCPcopy Create free account
hub / github.com/gonum/plot / Plot

Method Plot

plotter/labels.go:75–85  ·  view source on GitHub ↗

Plot implements the Plotter interface, drawing labels.

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

Source from the content-addressed store, hash-verified

73
74// Plot implements the Plotter interface, drawing labels.
75func (l *Labels) Plot(c draw.Canvas, p *plot.Plot) {
76 trX, trY := p.Transforms(&c)
77 for i, label := range l.Labels {
78 pt := vg.Point{X: trX(l.XYs[i].X), Y: trY(l.XYs[i].Y)}
79 if !c.Contains(pt) {
80 continue
81 }
82 pt = pt.Add(l.Offset)
83 c.FillText(l.TextStyle[i], pt, label)
84 }
85}
86
87// DataRange returns the minimum and maximum X and Y values
88func (l *Labels) DataRange() (xmin, xmax, ymin, ymax float64) {

Callers

nothing calls this directly

Calls 4

AddMethod · 0.95
TransformsMethod · 0.80
ContainsMethod · 0.80
FillTextMethod · 0.80

Tested by

no test coverage detected