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

Function NewYErrorBars

plotter/errbars.go:40–63  ·  view source on GitHub ↗

NewYErrorBars returns a new YErrorBars plotter, or an error on failure. The error values from the YErrorer interface are interpreted as relative to the corresponding Y value. The errors for a given Y value are computed by taking the absolute value of the error returned by the YErrorer and subtractin

(yerrs interface {
	XYer
	YErrorer
})

Source from the content-addressed store, hash-verified

38// by taking the absolute value of the error returned by the YErrorer
39// and subtracting the first and adding the second to the Y value.
40func NewYErrorBars(yerrs interface {
41 XYer
42 YErrorer
43}) (*YErrorBars, error) {
44
45 errors := make(YErrors, yerrs.Len())
46 for i := range errors {
47 errors[i].Low, errors[i].High = yerrs.YError(i)
48 if err := CheckFloats(errors[i].Low, errors[i].High); err != nil {
49 return nil, err
50 }
51 }
52 xys, err := CopyXYs(yerrs)
53 if err != nil {
54 return nil, err
55 }
56
57 return &YErrorBars{
58 XYs: xys,
59 YErrors: errors,
60 LineStyle: DefaultLineStyle,
61 CapWidth: DefaultCapWidth,
62 }, nil
63}
64
65// Plot implements the Plotter interface, drawing labels.
66func (e *YErrorBars) Plot(c draw.Canvas, p *plot.Plot) {

Callers 3

ExampleErrorsFunction · 0.92
AddErrorBarsFunction · 0.92
AddYErrorBarsFunction · 0.92

Calls 4

CheckFloatsFunction · 0.85
CopyXYsFunction · 0.85
LenMethod · 0.65
YErrorMethod · 0.65

Tested by 1

ExampleErrorsFunction · 0.74