I have calculated medians, lower/upper quartiles, minimum and maximum values as part of a separate application of mine and written those values to a file and I would like to
There's a baked-in function in matplotlib--bxp--that let's you specify the calculated statistics rather than the raw data to calculate from, avoiding the need to create your own function.
You'll need to call it as a method from your Axes
object rather than from plt
:
import matplotlib.pyplot as plt
stats = [
{'med': 5, 'q1': 2, 'q3': 6, 'whislo': 1, 'whishi': 8},
{'med': 4, 'q1': 2, 'q3': 6, 'whislo': 1, 'whishi': 8}
]
_, ax = plt.subplots();
ax.bxp(stats, showfliers=False);
Importantly, your input needs to be a list of dictionaries, corresponding to a list of boxes (even if just 1) to draw.