
上QQ阅读APP看书,第一时间看更新
How to do it...
The following is the code block that draws violin plots:
- Read the data from a CSV file into a pandas DataFrame:
wine_quality = pd.read_csv('winequality.csv', delimiter=';')
- Prepare the list of three attributes of wine_quality:
data = [wine_quality['alcohol'], wine_quality['fixed acidity'],
wine_quality['quality']]
- Plot the violin plot:
plt.violinplot(data, showmeans=True)
- Display the plot on the screen:
plt.show()