Boxplot

logo of a chart:Box1

A boxplot summarizes the distribution of a numeric variable for one or several groups. It allows to quickly get the median, quartiles and outliers but also hides the dataset individual data points.

In python, boxplots can be made with both seaborn and matplotlib as they both offer a boxplot() function made for the job.

⚠️ Mind the boxplot

A boxplot is an awesome way to summarize the distribution of a variable. However it hides the real distribution and the sample size. Check the 3 charts below that are based on the exact same dataset.

To read more about this, visit data-to-viz.com that has a dedicated article.

Seaborn logoBoxplots with Seaborn

Seaborn is a python library allowing to make better charts easily. The boxplot function should get you started in minutes. The examples below aim at showcasing the various possibilities this function offers.

Matplotlib logoBoxplots with Matplotlib

Matplotlib also has a boxplot() function made to build boxplots.

The following tutorials will guide you from its basic usage to the finest customization:

Matplotlib logoBest python boxplot examples

The web is full of astonishing charts made by awesome bloggers, (often using R). The Python graph gallery tries to display (or translate from R) some of the best creations and explain how their source code works. If you want to display your work here, please drop me a word or even better, submit a Pull Request!

Contact


👋 This document is a work by Yan Holtz. You can contribute on github, send me a feedback on twitter or subscribe to the newsletter to know when new examples are published! 🔥