'Can you make a violinplot using only one data point and the quantiles calculated in python?
I have a model that makes a prediction and intervals for the prediction of wine prices in python. To this i need som visualization of the finished product.
I'm wondering if it's possible to create a violin plot using only one data point and the interval as it is what my model does. I have done this for a boxplot, but wanted to have a different visualization.
I have created a boxplot this way using stats this way where price, q1, q3, interval_lower and interval_upper are all single datapoints that the model predicts:
stats = [{
"med": price,
"q1": q1,
"q3": q3,
"whislo": interval_lower, # required
"whishi": interval_upper, # required
"fliers": [] # required if showfliers=True
}]
fs = 10 # fontsize
fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(6, 6), sharey=True)
bp = axes.bxp(stats, patch_artist=True)
axes.set_title('Boxplot for wine prediction', fontsize=fs,color='Blue')
plt.show(bp)
This works fine for boxplots, but i cannot find a way to use violinplot in the same way. Does anyone know a way to do this? I'm using jupyter notebook for python.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
