# Box plot A box plot compresses a distribution into five numbers and shows the outliers separately. It is the right chart when comparing distributions across groups rather than a single average. Anybody comparing performance across services or teams should be looking at one of these rather than at a bar chart of means. --- ## When this is the right chart * Comparing distributions across groups. * Performance data, where the tail matters more than the mean. * Any comparison currently being made with averages. --- ## What the data needs to look like | **Field** | **Type** | | --------- | ---------------------------------- | | Group | Nominal | | Value | Quantitative: the raw measurements | --- ## A worked example Latency by service, showing the spread: ![Box plot](https://help.gocapable.com/images/att1430978611.svg) The source, which you can paste into a new diagram and edit: ``` { "$schema": "https://vega.github.io/schema/vega-lite/v5.json", "description": "Response time distribution by service", "width": 380, "height": 240, "data": {"values": [ {"service": "api", "ms": 42}, {"service": "api", "ms": 61}, {"service": "api", "ms": 70}, {"service": "api", "ms": 78}, {"service": "api", "ms": 96}, {"service": "api", "ms": 310}, {"service": "search", "ms": 120}, {"service": "search", "ms": 160}, {"service": "search", "ms": 180}, {"service": "search", "ms": 240}, {"service": "search", "ms": 610}, {"service": "search", "ms": 980}, {"service": "reporting", "ms": 900}, {"service": "reporting", "ms": 1400}, {"service": "reporting", "ms": 1800}, {"service": "reporting", "ms": 2400}, {"service": "reporting", "ms": 5200} ]}, "mark": {"type": "boxplot", "extent": "min-max"}, "encoding": { "x": {"field": "service", "type": "nominal", "title": null}, "y": {"field": "ms", "type": "quantitative", "title": "Response time (ms)", "scale": {"type": "log"}} } } ``` --- ## A few things that catch people out * Say what the whiskers mean. Min-max and 1.5 times the interquartile range are both common and different. * Box plots hide bimodal distributions. If you suspect one, use a histogram too. * With few data points per group, plot the points instead. A box plot of five values is theatre. --- ## Related [Radar chartSeveral entities across the same criteria.](https://help.gocapable.com/diagrams/radar-chart.html) [Word cloudTerms sized by weight.](https://help.gocapable.com/diagrams/word-cloud.html) [Charts and graphsBack to the chart overview.](https://help.gocapable.com/diagrams/charts-and-graphs.html) --- _Pick the chart for the question, not for the look._