MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: question on ErrorBar



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
____________________________________________________________________



  • Prev by Date: Re: Re: How to change the argument of a function?
  • Next by Date: Re: Random Order of a Set of Numbers
  • Prev by thread: Re: question on ErrorBar
  • Next by thread: Version 3 Foramtting question