I want to mimic the following style (not necessarily the same data)

enter image description here

So far, I got the following

BoxWhiskerChart[{{1, 3, 2, 5, 6, 5, 10}, {1, 3, 2, 5, 6, 5, 10}},
 {{"Whiskers", Thick}, {"Fences", Thick}}, 
 ChartStyle -> {EdgeForm[{Black, 
     Thickness[.007]}], {RGBColor[{178, 34, 34}/255], 
    RGBColor[{100, 149, 237}/255]}}]

enter image description here

How can I:

  1. Edit the median color and its thickness
  2. Get the horizontal gray lines for integers
  3. Detect and represent outliers as circles, if any

Any ideas?


1 Answer 1

data = RandomReal[ParetoDistribution[3, 4], {2, 100}];

bwc = BoxWhiskerChart[data, 
  {{"Whiskers", Thick},
   {"Outliers", Style["○", Red]},
   {"MedianMarker", Directive[Thick, Yellow]}, 
   {"Fences", Thick}}, 
 ChartStyle -> {EdgeForm[{Black,Thickness[.007]}],
    {RGBColor[{178, 34, 34}/255], RGBColor[{100, 149, 237}/255]}}, 
 GridLines -> {None, Automatic}]

enter image description here

Post-process to move the median marker behind box edges:

Replace[bwc, {a___, b_PolygonBox, c___} :> {a, b, c, FaceForm[], b}, All]

enter image description here

  • $\begingroup$ Thank you so much. I was wondering if there is a way of getting the thickness of the EdgeForm to be in accordance with the Thick option for Whiskers, Fences and MedianMarker, instead of having to pick by hand the value .007. Nonetheless, perfect answer. $\endgroup$
    – sam wolfe
    Commented Oct 18, 2021 at 13:26
  • 2
    $\begingroup$ @samwolfe, Use Thick instead of Thickness[.007]? $\endgroup$
    – kglr
    Commented Oct 18, 2021 at 13:40

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.