小网格图:seaborn.FacetGrid

这个小网格图,是对各种图像都适用,

  1. 主要是sns.FacetGrid对横纵分类的标准选择
  2. g.map(plt.scatter, “total_bill”, “tip”, edgecolor=“w”)对单个图像横纵坐标的标识

代码:

import seaborn as sns
sns.set(style="ticks", color_codes=True)
import matplotlib.pyplot as plt


#g = sns.FacetGrid(tips, col="time",  row="smoker")
#g = g.map(plt.hist, "total_bill")

#
import numpy as np
tips = sns.load_dataset("tips")
bins = np.arange(0, 65, 5)
##这里的time 和 smoker 是指在图像行与行之间有什么差异,比如这里第一行是smoker,第二行是不抽烟
#g = sns.FacetGrid(tips, col="time",  row="smoker")
##
#g = g.map(plt.hist, "total_bill", bins=bins, color="r")


#g = sns.FacetGrid(tips, col="time",  row="smoker")

#这里设置显示图片的横纵坐标
#g = g.map(plt.scatter, "total_bill", "tip", edgecolor="w")

#g = sns.FacetGrid(tips, col="time",  hue="smoker")
#g = (g.map(plt.scatter, "total_bill", "tip", edgecolor="w").add_legend())

#
#g = sns.FacetGrid(tips, col="day", height=4, aspect=.5)
#g = g.map(plt.hist, "total_bill", bins=bins)

g = sns.FacetGrid(tips, col="smoker", col_order=["Yes", "No"])
g = g.map(plt.hist, "total_bill", bins=bins, color="m")

出图相关
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值