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


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


2 Answers 2

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


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


Your Answer

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

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