2
$\begingroup$

I have a list of experimental points. Each point was measured one or several times:

{{0, 2}, {0, 10}, {10, 90}, {20, 150}, {20, 144}, {20, 152}, {20, 161}, 
 {30, 198}, {30, 192}, {40, 210}, {50, 230}, {50, 228}, {50, 221}, 
 {60, 235}, {60, 230}} // ListPlot

Is it possible to use this list to plot ErrorListPlot? In other words how I can calculate new list {{x,mean_y_at_x, ErrorBar[sd]}, ...} from initial one? Sorry for possible duplicate, but I could not find answer.

$\endgroup$
3
$\begingroup$
data = {{0, 2}, {0, 10}, {10, 90}, {20, 150}, {20, 144}, {20, 152}, 
  {20, 161}, {30, 198}, {30, 192}, {40, 210}, {50, 230}, {50, 228}, 
  {50, 221}, {60, 235}, {60, 230}}; 

gathered = GatherBy[data, First];

elpdata =Through[{Mean, ErrorBar@If[Length@#==1, 0, StandardDeviation@#]&}@#]& /@ gathered

Needs["ErrorBarPlots`"]
ErrorListPlot[elpdata]

Mathematica graphics

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.