Is it possible to draw a 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

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

Weighted percentile using numpy

Completely vectorized numpy solution Here is the code I use. It’s not an optimal one (which I’m unable to write with numpy), but still much faster and more reliable than accepted solution def weighted_quantile(values, quantiles, sample_weight=None, values_sorted=False, old_style=False): “”” Very close to numpy.percentile, but supports weights. NOTE: quantiles should be in [0, 1]! :param values: … Read more