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

Method OutsideLabels

plotter/quartile.go:159–176  ·  view source on GitHub ↗

OutsideLabels returns a *Labels that will plot a label for each of the outside points. The labels are assumed to correspond to the points used to create the plot.

(labels Labeller)

Source from the content-addressed store, hash-verified

157// labels are assumed to correspond to the
158// points used to create the plot.
159func (b *QuartPlot) OutsideLabels(labels Labeller) (*Labels, error) {
160 if b.Horizontal {
161 b := &horizQuartPlot{b}
162 return b.OutsideLabels(labels)
163 }
164 strs := make([]string, len(b.Outside))
165 for i, out := range b.Outside {
166 strs[i] = labels.Label(out)
167 }
168 o := quartPlotOutsideLabels{b, strs}
169 ls, err := NewLabels(o)
170 if err != nil {
171 return nil, err
172 }
173 off := 0.5 * b.MedianStyle.Radius
174 ls.Offset = ls.Offset.Add(vg.Point{X: off, Y: off})
175 return ls, nil
176}
177
178type quartPlotOutsideLabels struct {
179 qp *QuartPlot

Callers

nothing calls this directly

Calls 3

NewLabelsFunction · 0.85
LabelMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected