2
$\begingroup$

Sorry about the informality but I am posting from my phone here.

Is it possible to draw/sketch a boxplot only using the values of quartiles? For example, minimum is 1, max is 10 lower quartile is 2 and upper quartile is 6, with median 4.

$\endgroup$
3
  • $\begingroup$ If the background color is white: BoxWhiskerChart[ RandomVariate[NormalDistribution[0, 1], 100], {"Basic", {"Whiskers", White}}]. $\endgroup$ – JimB Sep 25 '18 at 20:51
  • $\begingroup$ Or is your question "How do I estimate the minimum and maximum given the 3 quartiles?" $\endgroup$ – JimB Sep 25 '18 at 21:06
  • 1
    $\begingroup$ BoxWhiskerChart[{ 1, 2, 4, 6, 10 }]? $\endgroup$ – kglr Sep 25 '18 at 21:19
5
$\begingroup$

The "BoxRange" method option to BoxWhiskerChart provides a few ways of computing the key statistics for drawing the box-whisker chart. In the most general form, when given a function f, it applies f to the data to compute the min, max, median, and quartiles. By using the identity function, you can just pass in the precomputed values as the data to BoxWhiskerChart and use them instead of the normal calculations.

BoxWhiskerChart[{1, 2, 4, 6, 10}, Method -> {"BoxRange" -> (# &)}]

enter image description here

$\endgroup$
5
  • 1
    $\begingroup$ Neat trick! BoxWhiskerChart[{1, 2, 4, 6, 10}, Method -> {"BoxRange" -> Identity}] also works of course. $\endgroup$ – J. M.'s ennui Sep 26 '18 at 3:08
  • $\begingroup$ Yeah, I thought of that when I wrote "identity function", but felt that in this case #& was more illustrative, since it's clearer that something is being passed in as opposed to being a special value. And it's a feature, not a trick. :-) $\endgroup$ – Brett Champion Sep 26 '18 at 3:13
  • 1
    $\begingroup$ in version 9, BoxWhiskerChart[{1, 2, 4, 6, 10}] , BoxWhiskerChart[{1, 2, 4, 6, 10}, Method -> {"BoxRange" -> (#&)}], BoxWhiskerChart[{1, 2, 4, 6, 10}, Method -> {"BoxRange" -> Quartiles}] all give the same output. $\endgroup$ – kglr Sep 26 '18 at 3:28
  • $\begingroup$ On a related note, I don't see any option to put it to horizontal?? I can't find it anywhere. $\endgroup$ – Chen Stats Yu Sep 28 '18 at 21:23
  • $\begingroup$ BarOrigin -> Left? $\endgroup$ – Brett Champion Sep 29 '18 at 1:36

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.