jumpkin1122
import seaborn as sns
import matplotlib.pyplot as plt

data = sns.load_dataset("tips")
print(data.head())
# 画图
sns.set(style="whitegrid", palette="pastel", color_codes=True)
sns.violinplot(x="day", y="total_bill", hue="smoker", split=True, inner="quart", palette={"Yes": "y", "No": "b"}, data=data)
sns.despine(left=True)
plt.show()

运行结果:

   total_bill   tip     sex smoker  day    time  size
0       16.99  1.01  Female     No  Sun  Dinner     2
1       10.34  1.66    Male     No  Sun  Dinner     3
2       21.01  3.50    Male     No  Sun  Dinner     3
3       23.68  3.31    Male     No  Sun  Dinner     2
4       24.59  3.61  Female     No  Sun  Dinner     4

可视化效果:

  

 

分类:

技术点:

相关文章:

  • 2021-08-31
  • 2021-09-10
  • 2021-08-31
  • 2021-12-30
  • 2021-06-03
  • 2021-08-31
  • 2021-10-02
猜你喜欢
  • 2021-11-02
  • 2021-08-31
  • 2021-08-31
  • 2021-08-31
  • 2021-08-31
  • 2021-08-31
  • 2021-08-31
相关资源
相似解决方案