Function error draw error boxes around the points. You can draw default boxes or semi-transparent symbol (like marker, see Line styles). Also you can set individual color for each box. See also Sample ‘error2’.
MGL code:
call 'prepare1d' new y 50 '0.7*sin(pi*x-pi) + 0.5*cos(3*pi*(x+1)/2) + 0.2*sin(pi*(x+1)/2)' new x0 10 'x + 0.1*rnd-0.05':new ex 10 '0.1':new ey 10 '0.2' new y0 10 '0.7*sin(pi*x-pi) + 0.5*cos(3*pi*(x+1)/2) + 0.2*sin(pi*(x+1)/2) + 0.2*rnd-0.1' subplot 2 2 0 '':title 'Error plot (default)':box:plot y:error x0 y0 ex ey 'k' subplot 2 2 1 '':title '"!" style; no e_x':box:plot y:error x0 y0 ey 'o!rgb' subplot 2 2 2 '':title '"\@" style':alpha on:box:plot y:error x0 y0 ex ey '@'; alpha 0.5 subplot 2 2 3:title '3d variant':rotate 50 60:axis for $1 0 9 errbox 2*rnd-1 2*rnd-1 2*rnd-1 0.2 0.2 0.2 'bo' next
C++ code:
void smgl_error2(mglGraph *gr) { mglData x0(10), y0(10), ex(10), ey(10); for(int i=0;i<10;i++) { x0.a[i] = mgl_rnd(); y0.a[i] = mgl_rnd(); ey.a[i] = ex.a[i] = 0.1; } gr->SetRanges(0,1,0,1); gr->Alpha(true); gr->SubPlot(4,3,0,""); gr->Box(); gr->Error(x0,y0,ex,ey,"#+@"); gr->SubPlot(4,3,1,""); gr->Box(); gr->Error(x0,y0,ex,ey,"#x@"); gr->SubPlot(4,3,2,""); gr->Box(); gr->Error(x0,y0,ex,ey,"#s@","alpha 0.5"); gr->SubPlot(4,3,3,""); gr->Box(); gr->Error(x0,y0,ex,ey,"s@"); gr->SubPlot(4,3,4,""); gr->Box(); gr->Error(x0,y0,ex,ey,"d@"); gr->SubPlot(4,3,5,""); gr->Box(); gr->Error(x0,y0,ex,ey,"#d@","alpha 0.5"); gr->SubPlot(4,3,6,""); gr->Box(); gr->Error(x0,y0,ex,ey,"+@"); gr->SubPlot(4,3,7,""); gr->Box(); gr->Error(x0,y0,ex,ey,"x@"); gr->SubPlot(4,3,8,""); gr->Box(); gr->Error(x0,y0,ex,ey,"o@"); gr->SubPlot(4,3,9,""); gr->Box(); gr->Error(x0,y0,ex,ey,"#o@","alpha 0.5"); gr->SubPlot(4,3,10,""); gr->Box(); gr->Error(x0,y0,ex,ey,"#.@"); gr->SubPlot(4,3,11,""); gr->Box(); gr->Error(x0,y0,ex,ey); }