Skip to content

Box plot

According to Wikipedia, a box plot

is a method for demonstrating graphically the locality, spread and skewness groups of numerical data through their quartiles. In addition to the box on a box plot, there can be lines (which are called whiskers) extending from the box indicating variability outside the upper and lower quartiles, thus, the plot is also called the box-and-whisker plot and the box-and-whisker diagram.

Parameters

Box plot accepts all of the standard parameters with the data (or path) parameter defined as follows:

dataJSON or Python list of dicts

The data for box plots is a (JSON) list of dictionaries, of the form:

json
[
  {
    "category": "A",
    "values": [10, 15, 20]
  },
  {
    "category": "B",
    "values": [30, 35, 40]
  }
]

as shown above. An alternate form allows data to be provided in CSV:

csv
category, value
A, 10
A, 15
A, 20
B, 30
B, 35
B, 40

or equivalently in JSON:

json
[
  { "category": "A", "value": 10 },
  { "category": "A", "value": 15 },
  { "category": "A", "value": 20 },
  { "category": "B", "value": 30 },
  { "category": "B", "value": 35 },
  { "category": "B", "value": 40 }
]

Example

The following:

html
<boxplot
  data='
  [
    {
      "category": "A",
      "values": [10, 15, 20]
    },
    {
      "category": "B",
      "values": [30, 35, 40]
    }
  ]'
  width=500
  height=350
</boxplot>

would produce the following chart:

Released under the MIT License. | Privacy Policy