Re: question on ErrorBar
- To: mathgroup@smc.vnet.net
- Subject: [mg10924] Re: question on ErrorBar
- From: Paul Abbott <paul@physics.uwa.edu.au>
- Date: Thu, 12 Feb 1998 20:16:06 -0500
- Organization: University of Western Australia
- References: <6brgk6$eck@smc.vnet.net>
Ben Yung wrote:
> I'm having trouble with using the ErrorBar option in the
> MultipleListPlot. I have a list of datapoints {x,y}, as well as a
> list of errors {xerror, yerror}. The syntax is as follows:
>
> MultipleListPlot[{{x1,y1},ErrorBar[{xerror1,yerror1}]},{{x2,y2},
>
> {{x2,y2},ErrorBar[{xerror2,yerror2}]},{etc.....}]
I think you mean ErrorBar[{x1, x2}, {y1, y2}] here.
> Is their a convenient way to input my two lists?
Here is one way:
In[1]:= data=Table[{x,Sin[x]},{x,0.,3,0.5}];
Generate two lists of errors:
In[2]:= xerror=Table[{-1,1}Random[]/3,{Length[data]}]; In[3]:=
yerror=Table[{-1,1}Random[]/3,{Length[data]}];
(I have symmetric errors generated by direct multiplication by {-1,1}.
In[4]:= <<Graphics`MultipleListPlot`
Here are the errorbars
In[5]:= errorbars= Apply[ErrorBar,Transpose[{xerror,yerror}],{1}];
Now we can write
In[6]:= MultipleListPlot[Transpose[{data,errorbars}]];
Cheers,
Paul
____________________________________________________________________
Paul Abbott Phone: +61-8-9380-2734
Department of Physics Fax: +61-8-9380-1014
The University of Western Australia Nedlands WA 6907
mailto:paul@physics.uwa.edu.au AUSTRALIA
http://www.pd.uwa.edu.au/~paul
God IS a weakly left-handed dice player
____________________________________________________________________