boxplot
Boxplots in matplotlib: Markers and outliers
A picture is worth a thousand words. Note that the outliers (the + markers in your plot) are simply points outside of the wide [(Q1-1.5 IQR), (Q3+1.5 IQR)] margin below. However, the picture is only an example for a normally distributed data set. It is important to understand that matplotlib does not estimate … Read more
Is it possible to draw a matplotlib boxplot given the percentile values instead of the original inputs?
As of 2020, there is a better method than the one in the accepted answer. The matplotlib.axes.Axes class provides a bxp method, which can be used to draw the boxes and whiskers based on the percentile values. Raw data is only needed for the outliers, and that is optional. Example: import matplotlib.pyplot as plt fig, … Read more
How to draw the boxplot with significant level?
I know that this is an old question and the answer by DatamineR already provides one solution for the problem. But I recently created a ggplot-extension that simplifies the whole process of adding significance bars: ggsignif Instead of tediously adding the geom_line and annotate to your plot you just add a single layer geom_signif: library(ggplot2) … Read more
Seaborn load_dataset
load_dataset looks for online csv files on https://github.com/mwaskom/seaborn-data. Here’s the docstring: Load a dataset from the online repository (requires internet). Parameters name : str Name of the dataset (name.csv on https://github.com/mwaskom/seaborn-data). You can obtain list of available datasets using :func:get_dataset_names kws : dict, optional Passed to pandas.read_csv If you want to modify that online dataset … Read more
How to edit properties of whiskers, fliers, caps, etc. in Seaborn boxplot
EDIT: Note that this method appears to no longer work for matplotlib versions >=3.5. See the answer by @JohanC for an up to date answer You need to edit the Line2D objects, which are stored in ax.lines. Heres a script to create a boxplot (based on the example here), and then edit the lines and … Read more
Removing one tableGrob when applied to a box plot with a facet_wrap
It would probably make sense to let annotation_custom access facetting info *; this trivial change seems to do the trick, library(ggplot2) library(grid) library(gridExtra) annotation_custom2 <- function (grob, xmin = -Inf, xmax = Inf, ymin = -Inf, ymax = Inf, data) { layer(data = data, stat = StatIdentity, position = PositionIdentity, geom = ggplot2:::GeomCustomAnn, inherit.aes = … Read more
In ggplot2, what do the end of the boxplot lines represent?
The “dots” at the end of the boxplot represent outliers. There are a number of different rules for determining if a point is an outlier, but the method that R and ggplot use is the “1.5 rule”. If a data point is: less than Q1 – 1.5*IQR greater than Q3 + 1.5*IQR then that point … Read more