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

Method Plot

plot/plots/errbars.go:218–246  ·  view source on GitHub ↗

Plot implements the Plotter interface, drawing labels.

(plt *plot.Plot)

Source from the content-addressed store, hash-verified

216
217// Plot implements the Plotter interface, drawing labels.
218func (e *XErrorBars) Plot(plt *plot.Plot) {
219 pc := plt.Paint
220 uc := &pc.UnitContext
221
222 e.CapWidth.ToDots(uc)
223 cw := 0.5 * e.CapWidth.Dots
224
225 nv := len(e.XErrors)
226 e.PXYs = make(plot.XYs, nv)
227 e.LineStyle.SetStroke(plt)
228 for i, err := range e.XErrors {
229 y := plt.PY(e.XYs[i].Y)
230 xlow := plt.PX(e.XYs[i].X - math32.Abs(err.Low))
231 xhigh := plt.PX(e.XYs[i].X + math32.Abs(err.High))
232
233 e.PXYs[i].X = xhigh
234 e.PXYs[i].Y = y
235
236 pc.MoveTo(xlow, y)
237 pc.LineTo(xhigh, y)
238
239 pc.MoveTo(xlow, y-cw)
240 pc.LineTo(xlow, y+cw)
241
242 pc.MoveTo(xhigh, y-cw)
243 pc.LineTo(xhigh, y+cw)
244 pc.Stroke()
245 }
246}
247
248// DataRange implements the plot.DataRanger interface.
249func (e *XErrorBars) DataRange() (xmin, xmax, ymin, ymax float32) {

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected