MCPcopy Create free account
hub / github.com/cogentcore/core / Plot

Method Plot

plot/plots/errbars.go:110–137  ·  view source on GitHub ↗

Plot implements the Plotter interface, drawing labels.

(plt *plot.Plot)

Source from the content-addressed store, hash-verified

108
109// Plot implements the Plotter interface, drawing labels.
110func (e *YErrorBars) Plot(plt *plot.Plot) {
111 pc := plt.Paint
112 uc := &pc.UnitContext
113
114 e.CapWidth.ToDots(uc)
115 cw := 0.5 * e.CapWidth.Dots
116 nv := len(e.YErrors)
117 e.PXYs = make(plot.XYs, nv)
118 e.LineStyle.SetStroke(plt)
119 for i, err := range e.YErrors {
120 x := plt.PX(e.XYs[i].X)
121 ylow := plt.PY(e.XYs[i].Y - math32.Abs(err.Low))
122 yhigh := plt.PY(e.XYs[i].Y + math32.Abs(err.High))
123
124 e.PXYs[i].X = x
125 e.PXYs[i].Y = yhigh
126
127 pc.MoveTo(x, ylow)
128 pc.LineTo(x, yhigh)
129
130 pc.MoveTo(x-cw, ylow)
131 pc.LineTo(x+cw, ylow)
132
133 pc.MoveTo(x-cw, yhigh)
134 pc.LineTo(x+cw, yhigh)
135 pc.Stroke()
136 }
137}
138
139// DataRange implements the plot.DataRanger interface.
140func (e *YErrorBars) DataRange() (xmin, xmax, ymin, ymax float32) {

Callers

nothing calls this directly

Calls 8

AbsFunction · 0.92
PXMethod · 0.80
PYMethod · 0.80
MoveToMethod · 0.80
LineToMethod · 0.80
StrokeMethod · 0.80
ToDotsMethod · 0.45
SetStrokeMethod · 0.45

Tested by

no test coverage detected