Re: question on ErrorBar
- To: mathgroup@smc.vnet.net
- Subject: [mg10947] Re: [mg10864] question on ErrorBar
- From: seanross@worldnet.att.net
- Date: Sat, 14 Feb 1998 00:53:20 -0500
- References: <199802112332.SAA19004@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.....}]
>
> Is their a convenient way to input my two lists?
>
> Thanks!
Assume a list of values and errors as below:
values={{1,2},{1,2},{2,3},{4,5},{6,7},{8,9},{0,1}}; errors=
{{0.1,0.2},{0.3,0.4},{0.5,0.6},{0.7,0.8},{0.9,0},
{0.11,0.12},{0.13,0.14}};
Map[ErrorBar,errors]
Returns
{ErrorBar[{0.1,0.2}],ErrorBar[{0.3,0.4}],ErrorBar[{0.5,0.6}],
ErrorBar[{0.7,0.8}],ErrorBar[{0.9,0}],ErrorBar[{0.11,0.12}],
ErrorBar[{0.13,0.14}]}
So that the correct list for input to MultipleListPlot is
Transpose[{values,Map[ErrorBar,errors]}]
{{{1,2},ErrorBar[{0.1,0.2}]},
{{1,2},ErrorBar[{0.3,0.4}]},
{{2,3},ErrorBar[{0.5,0.6}]},
{{4,5},ErrorBar[{0.7,0.8}]},
{{6,7},ErrorBar[{0.9,0}]},
{{8,9},ErrorBar[{0.11,0.12}]},
{{0,1},ErrorBar[{0.13,0.14}]}}
The syntax you asked for is given by
Flatten[Transpose[{values,Map[ErrorBar,errors]}],1]
{{1,2},ErrorBar[{0.1,0.2}],
{1,2},ErrorBar[{0.3,0.4}],
{2,3},ErrorBar[{0.5,0.6}],
{4,5},ErrorBar[{0.7,0.8}],
{6,7},ErrorBar[{0.9,0}],
{8,9},ErrorBar[{0.11,0.12}],
{0,1},ErrorBar[{0.13,0.14}]}
but I don't think this will work in MultipleListPlot.
--
Remove the _nospam_ in the return address to respond.
- References:
- question on ErrorBar
- From: Ben Yung <benyung@unixg.ubc>
- question on ErrorBar