Plot implements the Plotter interface, drawing labels.
(plt *plot.Plot)
| 216 | |
| 217 | // Plot implements the Plotter interface, drawing labels. |
| 218 | func (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. |
| 249 | func (e *XErrorBars) DataRange() (xmin, xmax, ymin, ymax float32) { |