
上QQ阅读APP看书,第一时间看更新
How it works...
Here is the explanation for the code:
- plt.violinplot() draws the violin plot. The bottom whisker is the minimum value, the top whisker is the maximum value, and the horizontal line is at the mean value. On both sides of the vertical line is the histogram of the data representing the actual distribution of the data. By replacing showmeans=True with showmedian=True, we can have a horizontal line representing the median of the data instead of the mean: