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

Method OutsideLabels

plotter/boxplot.go:289–307  ·  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 box plot.

(labels Labeller)

Source from the content-addressed store, hash-verified

287// labels are assumed to correspond to the
288// points used to create the box plot.
289func (b *BoxPlot) OutsideLabels(labels Labeller) (*Labels, error) {
290 if b.Horizontal {
291 b := &horizBoxPlot{b}
292 return b.OutsideLabels(labels)
293 }
294
295 strs := make([]string, len(b.Outside))
296 for i, out := range b.Outside {
297 strs[i] = labels.Label(out)
298 }
299 o := boxPlotOutsideLabels{b, strs}
300 ls, err := NewLabels(o)
301 if err != nil {
302 return nil, err
303 }
304 off := 0.5 * b.GlyphStyle.Radius
305 ls.Offset = ls.Offset.Add(vg.Point{X: off, Y: off})
306 return ls, nil
307}
308
309type boxPlotOutsideLabels struct {
310 box *BoxPlot

Callers 1

ExampleBoxPlotFunction · 0.95

Calls 3

NewLabelsFunction · 0.85
LabelMethod · 0.65
AddMethod · 0.45

Tested by 1

ExampleBoxPlotFunction · 0.76