Message Boards Message Boards

0
|
1302 Views
|
4 Replies
|
2 Total Likes
View groups...
Share
Share this post:

How do you create a box plot without a complete dataset?

Posted 1 year ago

Hi all!

I'm a beginner at Mathematica and I've been trying to create some data visualizations for a school assignment. In particular, I want to make a box-and-whisker plot, however, the tutorial I found (here --> https://reference.wolfram.com/language/StatisticalPlots/ref/BoxWhiskerPlot.html) only uses an example with a dataset of randomly generated numbers. With the data I am given, I only have the minimum, first quartile, median, third quartile, and maximum, and not the entire dataset, so how can I use only those to create my graphic?

Thank you!

POSTED BY: Margaret Chen
4 Replies
Posted 1 year ago

Thank you again for your help! This is great :)

POSTED BY: Margaret Chen

Remove the space in data 1 and data 2. Also, the data are a list, not a chart:

data1 = With[{min = 0, fq = 5/4, md = 4, tq = 5, max = 9},
   {min, fq, md, md, tq, max}];
data2 = With[{min = 2, fq = 3, md = 10, tq = 11, max = 18},
   {min, fq, md, md, tq, max}];
BoxWhiskerChart[{data1, data2}]
POSTED BY: Gianluca Gorni
Posted 1 year ago

Thank you!

What if I wanted to combine both in a single plot? I tried

data 1 = With[{min = 0, fq = 5/4, md = 4, tq = 5, max = 9},
 BoxWhiskerChart[{min, fq, fq, md, tq, tq, max}]] 
data 2 = With[{min = 2, fq = 3, md = 10, tq = 11, max = 18},
 BoxWhiskerChart[{min, fq, fq, md, tq, tq, max}]]
BoxWhiskerPlot[data1, data2] 

But it didn't work. Any help would be appreciated!

POSTED BY: Margaret Chen

You can make a sample that has precisely those quantiles:

With[{min = 0, fq = 5/4, md = 4, tq = 5, max = 9},
 BoxWhiskerChart[{min, fq, fq, md, tq, tq, max}]]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract