用python的seaborn库画分类散点图

1. 带状分类散点图

准备工作及数据导入代码在博客seaborn库的介绍与使用里有:
https://blog.csdn.net/weixin_43799652/article/details/102484031

# 导入数据
tips = sns.load_dataset("tips")
tips.head()

在这里插入图片描述

  • sns.stripplot()
sns.stripplot(x = 'day',y = 'tip'
              ,data = tips
              )

用python的seaborn库画分类散点图_第1张图片

1.1 带状分类散点图其他参数

sns.stripplot(x = 'day',y = 'tip'
              ,data = tips
              ,hue = 'sex'        # 以性别分类
              ,palette = 'Blues'  # 设置颜色调色盘
             )

用python的seaborn库画分类散点图_第2张图片

  • dodge参数
sns.stripplot(x = 'day',y = 'tip'
              ,data = tips
              ,hue = 'sex'        # 以性别分类
              ,palette = 'Blues'  # 设置颜色调色盘
              ,dodge = True      # 分开显示
             )       

用python的seaborn库画分类散点图_第3张图片

2. 蜂群状分类散点图

  • sns.swarmplot()
sns.swarmplot(x = 'day',y = 'tip'
              ,data = tips
              )

用python的seaborn库画分类散点图_第4张图片

2.1 蜂群状分类散点图其他参数

sns.swarmplot(x = 'day',y = 'tip'
              ,data = tips
              ,hue = 'sex'          # 以性别分类 
              ,palette = 'icefire'  # 设置颜色调色盘
             )

用python的seaborn库画分类散点图_第5张图片

你可能感兴趣的:(数据可视化)