2
$\begingroup$

I have a list similar to the next, but with 361 arrays lists instead of 3:

list={{1,2,1,2,3,5},{1,2,3,4,3,3},{3,4,2,5,4,6}}

And I would like to make a plot showing the mean, standard deviation, max and min for each array, something similar to a serie of box-plots. How can I make this?

I already made this plot calculating the mean and standard deviation, but I would like something better enter image description here

$\endgroup$

2 Answers 2

1
$\begingroup$
fivestats = Map[Through@{Min, Mean @ # - StandardDeviation @ # &, Mean, 
       Mean @ # + StandardDeviation @ # &, Max} @ # &];

list2 = fivestats @ list;

TableForm[list2, TableHeadings -> {{"data 1", "data 2", "data 3"} , {"Min", 
    "Mean-StdDev", "Mean", "Mean+StdDev", "Max"}}]

enter image description here

ListLinePlot[Transpose @ list2, 
 PlotStyle -> {Automatic, Dashed, Automatic, Dashed, Automatic}, 
 Filling -> {2 -> {4}}, 
 PlotLegends -> {"Min", "Mean-StdDev", "Mean", "Mean+StdDev", "Max"}]

enter image description here

In versions 12.0+, you can use Around

list3 = Map[Through[{Min, Mean, Max, 
     Around[Mean @ #, StandardDeviation @ #]&} @ #] &]@list;

ListLinePlot[Transpose @ list3, IntervalMarkers -> "Bands"]

enter image description here

$\endgroup$
0
$\begingroup$

I've found that ErrorBar and ErrorBarListPlot are very useful for this sort of thing. Needs["ErrorBarPlots`"]

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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