Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I’d like to figure out how I can show my entire dataset overlaid on a box whisker plot.

data = {{0.763983, -1.11426, 1.05153, -0.0369066, 1.1571, 0.834856, 0.146695,
0.100646, 2.69399, 0.425281}, {0.506237, 1.05127, 1.58117, 
0.976295, 1.62204, 1.39005, 1.62387, 1.36098, 1.83858, 
0.709489}, {-1.62786, 0.947744, 4.50628, 0.444416, 1.30947, 0.60594,
0.890642, 4.04505, 4.57667, 0.781394}}

The following allows me to show Outliers overlaid on the plot. How would I go about overlaying all of the datapoint on the plot?

BoxWhiskerChart[data, {"Notched", {"MedianMarker", Blue}, {"Outliers", 
"\[EmptySmallCircle]", Red}},ChartLabels -> {"X", "Y", "Z"}]
share|improve this question
    
Show[BoxWhiskerChart[data], ListPlot[MapIndexed[{#2[[1]], #1} &, data, {2}]]] –  belisarius Feb 17 at 22:08
    
Thanks this works well…! Still learning the intricacies of Mathematica’s plotting routines –  Pam Feb 18 at 14:11
    
Belisarius, can you explain how the MapIndexed trick works. I seem to have a hard time understanding it. Would appreciate some help….. –  Pam Feb 18 at 14:15
    
Can you post an answer so that I can acknowledge this as an answer? –  Pam Feb 18 at 14:16

1 Answer 1

up vote 1 down vote accepted

One way to do it is:

Show[BoxWhiskerChart[data], ListPlot[MapIndexed[{#2[[1]], #1} &, data, {2}]]]

Mathematica graphics

MapIndexed operates just like Mapbut gives you a second argument which is the index of the list element you're getting each time.

share|improve this answer
    
I don’t still quite get {#2[[1]], #1} part of it… I know they stand for slot sequences but still don’t see how they map to the data… –  Pam Feb 18 at 15:08
    
@Pam Try MapIndexed[f, {a,b}] to see that #2[[1]] takes values 1, 2 and #1 takes values a, b –  belisarius Feb 18 at 15:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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