| Python | import numpy as npimport seaborn as sns
 import matplotlib.pyplot as plt
 # 生成随机数据
 data = np.random.randn(10)
 # 创建画布
 fig, ax = plt.subplots()
 # 绘制小提琴图
 sns.violinplot(data=data, color='c', ax=ax)
 # 在小提琴图中添加散点
 sns.scatterplot(data=data, color='b', ax=ax)
 # 设置标题和坐标轴标签
 plt.title('violinplot')
 plt.xlabel('X Axis')
 plt.ylabel('Y Axis')
 # 显示图形
 plt.show()
 |