liveBook · Manning

Box-and-whisker plot

As explained in Advanced Algorithms and Data Structures

A boxplot is a statistical visualization that summarizes a distribution using quartiles, a median, and selected extreme-value markers.

A box-and-whisker plot summarizes a distribution with quartiles, a median, whiskers, and optional outlier markers. The box spans Q1 to Q3: 25% of values fall below Q1, 50% below the median, and 75% below Q3. section 2.10.2

Read the plot by separating its main visual elements:

  • The box displays the interquartile range between Q1 and Q3. section 2.10.2
  • The median marks the central value, with half the samples below it. section 2.10.2
  • Whiskers show how far the data extends; outliers may be displayed separately but can make interpretation less clear. section 2.10.2

Comparing Huffman running times

Group recorded running times by Huffman method and branching factor, then use boxplots to compare each distribution. The plots complement mean running times by showing variation across calls. section 2.10.2

Figure 2.19 Explaining how to read an example boxplot. Boxplots show the distribution of samples using a nice and effective chart. The main idea is that the most relevant samples are those whose values lie between the first and third quartile. That is, we find three values, Q1, Q2 (aka the median), and Q3 such that 25% of the samples are smaller than Q1; 50% of the samples are smaller than Q2 (which is the very definition of median, by the way); and 75% of the samples are smaller than Q3. The box in the boxplot is meant to clearly visualize the values for Q1 and Q3. Whiskers, instead, shows how far from the median the data extends. To that end, we could also display outliers, that is, samples that are outside the whiskers’ span. Sometimes outliers, though, end up being more confusing than useful, so in this example we will not use them.

Use the annotated figure to connect Q1, the median, Q3, the box, whiskers, and optional outliers. section 2.10.2

How Advanced Algorithms and Data Structures covers it

How deep it goes
Defines quartiles, median, box, whiskers, and outliers, but does not develop their statistical computation.
Examples
Compares Huffman encoding running-time distributions for methods and heap branching factors.
What you can do after
Evaluate distribution spread and central tendency when comparing measured algorithm running times.
How it connects
Connects distributions, quartiles, median, outliers, running-time profiling, Pandas DataFrames, and Jupyter notebooks.

Also explained in

Compare how 6 books explain box-and-whisker plot →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Advanced Algorithms and Data Structures. The section links point to the parts of the book it draws on.