5
$\begingroup$

Is there an easy way to make BoxWhiskerChart show both the outliers and the median line? g1 below shows outliers but not the median line, and g2 shows the median line but not the outliers.

data = RandomReal[NormalDistribution[0, 1], 100];
g1 = BoxWhiskerChart[data, "Outliers"]
g2 = BoxWhiskerChart[data]

That is, can BoxWhiskerChart make a boxplot in the style of BoxWhiskerPlot?

Needs["StatisticalPlots`"]
data = RandomVariate[StudentTDistribution[5], 100];
BoxWhiskerPlot[data, BoxOutliers -> Automatic]

Thanks!

$\endgroup$
7
$\begingroup$

If you read the Details & Options section in the documentation for BoxWhiskerChart you will find that there are presets but also the ability to control each element. If you want both outliers and a median marker you could do something like the following.

   BoxWhiskerChart[
     RandomVariate[NormalDistribution[0, 1], 10]~
      Join~{5}, {{"Outliers", "o"}, {"MedianMarker", Automatic}}]

enter image description here

|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.