Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Yes, a matplotlib boxplot can be created using percentile values in place of the original inputs. This can be done by specifying the percentile values as the data for the boxplot function, instead of the original inputs.

For example, if you have a list of data and you want to create a boxplot using the 10th, 25th, 50th, 75th, and 90th percentiles, you can calculate these values using numpy and then pass them as the data for the boxplot function:

import numpy as np
import matplotlib.pyplot as plt

# create some sample data
data = np.random.randn(100)

# calculate the percentiles
p10, p25, p50, p75, p90 = np.percentile(data, [10, 25, 50, 75, 90])

# create the boxplot using the percentiles
plt.boxplot([p10, p25, p50, p75, p90])
plt.show()

This will create a boxplot using the percentiles as the data, instead of the original data points.