errorbar:= proc(L::{list, set}) local opt, opts, vert, symb, ecolour, tsize, vtsize, htsize, x1, x2, y1, y2, xs, ys, p1, p2; options `Maple Advisor Database 1.00 for Maple V Release 4 and 5`, `Copyright (c) 1997 by Robert B. Israel. All rights reserved`; if type(L, list(numeric)) then RETURN(errorbar([L], args)) fi ; opts := NULL; ecolour := black; vert := true; for opt in [args[2 .. nargs]] do if opt = 'horizontal' then vert := false elif type(opt, equation) then if op(1, opt) = 'ticksize' then tsize := op(2, opt) elif op(1, opt) = 'horizontal' then if type(op(2, opt), boolean) then vert := not op(2, opt) else ERROR(`bad optional argument`, opt) fi elif op(1, opt) = 'view' then if typematch(op(2, opt), [ (x1::numeric) .. (x2::numeric), (y1::numeric) .. (y2::numeric)]) then vtsize := .03*y2 - .03*y1; htsize := .03*x2 - .03*x1; opts := opts, opt else ERROR(`bad optional argument`, opt) fi elif op(1, opt) = 'symbol' then symb := op(2, opt) elif op(1, opt) = 'colour' or op(1, opt) = 'color' then ecolour := op(2, opt) else opts := opts, opt fi else ERROR(`bad optional argument`, opt) fi od; opts := opts, colour = ecolour; if assigned(symb) then p1 := plots[pointplot]( map(t -> t[1 .. 2], L), symbol = symb, opts) fi; if not assigned(tsize) then if assigned(vtsize) then if vert then tsize := vtsize else tsize := htsize fi elif 1 < nops(L) then if vert then xs := op(map2(op, 1, L)); tsize := .04*max(xs) - .04*min(xs) else ys := op(map2(op, 2, L)); tsize := .04*max(ys) - .04*min(ys) fi else tsize := .05 fi fi; p2 := plot( convert(map(`errorbar/getseg`, L, vert, tsize), set), opts); if assigned(symb) then plots[display]({p1, p2}) else p2 fi end; `errorbar/getseg`:= proc(L, vert, tsize) local yplus, yminus, y, t2; options `Maple Advisor Database 1.00 for Maple V Release 4 and 5`, `Copyright (c) 1997 by Robert B. Israel. All rights reserved`; t2 := 1/2*tsize; if vert then y := L[2] else y := L[1] fi; if nops(L) = 3 then yplus := y + L[3]; yminus := y - L[3] elif nops(L) = 4 then yplus := y + L[3]; yminus := y + L[4] else ERROR(`errorbar expects [x,y,error] but received`, L) fi; if vert then [[L[1], yplus], [L[1], yminus]], [[L[1] - t2, yplus], [L[1] + t2, yplus]], [[L[1] - t2, yminus], [L[1] + t2, yminus]] else [[yplus, L[2]], [yminus, L[2]]], [[yminus, L[2] - t2], [yminus, L[2] + t2]], [[yplus, L[2] - t2], [yplus, L[2] + t2]] fi end;