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

Function NewXErrorBars

plotter/errbars.go:148–171  ·  view source on GitHub ↗

Returns a new XErrorBars plotter, or an error on failure. The error values from the XErrorer interface are interpreted as relative to the corresponding X value. The errors for a given X value are computed by taking the absolute value of the error returned by the XErrorer and subtracting the first an

(xerrs interface {
	XYer
	XErrorer
})

Source from the content-addressed store, hash-verified

146// value of the error returned by the XErrorer and subtracting the first and
147// adding the second to the X value.
148func NewXErrorBars(xerrs interface {
149 XYer
150 XErrorer
151}) (*XErrorBars, error) {
152
153 errors := make(XErrors, xerrs.Len())
154 for i := range errors {
155 errors[i].Low, errors[i].High = xerrs.XError(i)
156 if err := CheckFloats(errors[i].Low, errors[i].High); err != nil {
157 return nil, err
158 }
159 }
160 xys, err := CopyXYs(xerrs)
161 if err != nil {
162 return nil, err
163 }
164
165 return &XErrorBars{
166 XYs: xys,
167 XErrors: errors,
168 LineStyle: DefaultLineStyle,
169 CapWidth: DefaultCapWidth,
170 }, nil
171}
172
173// Plot implements the Plotter interface, drawing labels.
174func (e *XErrorBars) Plot(c draw.Canvas, p *plot.Plot) {

Callers 3

ExampleErrorsFunction · 0.92
AddErrorBarsFunction · 0.92
AddXErrorBarsFunction · 0.92

Calls 4

CheckFloatsFunction · 0.85
CopyXYsFunction · 0.85
LenMethod · 0.65
XErrorMethod · 0.65

Tested by 1

ExampleErrorsFunction · 0.74