Python绘图总结(seaborn篇)之线性关系

这篇博客总结了使用seaborn库进行线性关系分析的方法,包括regplot()和lmplot()函数的运用,探讨了单变量及多变量的关系,并指出lmplot()在处理多变量关系时的优势,适合数据探索和分析。
摘要由CSDN通过智能技术生成

学习https://seaborn.pydata.org 记录,描述不一定准确,具体请参考官网

%matplotlib inline
import numpy as np
import pandas as pd
from scipy import stats, integrate
import seaborn as sns
import matplotlib.pyplot as plt

# seaborn中文乱码解决方案
from matplotlib.font_manager import FontProperties
myfont=FontProperties(fname=r'C:\Windows\Fonts\simhei.ttf',size=14)
sns.set(font=myfont.get_name())
np.random.seed(sum(map(ord, "regression")))
tips = sns.load_dataset("tips")

线性回归

1、regplot()

# 简单使用regplot()
sns.regplot(x="total_bill", y="tip", data=tips)

这里写图片描述

2、lmplot()

# 简单使用lmplot()
sns.lmplot(x="total_bill", y="tip", data=tips)

这里写图片描述

# x_jitter 表示沿轴随机分布,相对避免重叠
sns.lmplo
  • 5
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值