当前位置:网站首页>kdeplot()核密度估计图的介绍
kdeplot()核密度估计图的介绍
2022-08-08 06:20:00 【波尔德】
核密度估计图:
核密度估计是概率论中用来估计未知的密度函数,属于非参数校验方法之一。
通过核密度估计图可以比观的看出数据样本本身的分布特征。
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
#随机生成100个标准的正太分布数据,绘制核密度估计图
na=np.random.randn(100)
sns.kdeplot(na)
plt.show()
运行效果如下所示:
介绍kdeplot函数中的属性值:
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
# cumulative=True/False,是否绘制累计分布
na = np.random.randn(100)
sns.kdeplot(na, cumulative=True)
plt.show()
运行结果如下所示:
#shade=True/False 若为True,则在kde曲线下面的区域中进行阴影处理
na=np.random.randn(100)
sns.kdeplot(na,shade=True)
plt.show()
运行结果如下所示:
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
# color 控制曲线及阴影的颜色
na = np.random.randn(100)
sns.kdeplot(na, shade=True, color="black")
plt.show()
运行结果如下所示:
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
# vertical = False 带表在横轴绘制,默认为False
# vertical = True 带表在纵轴绘制
na = np.random.randn(100)
sns.kdeplot(na, shade=True, color="black", vertical=True)
plt.show()
运行结果如下所示:
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
# 二元kde图像(很少用到)
x = np.random.randn(100)
y = np.random.randn(100)
sns.kdeplot(x, y, shade=True, color="red")
plt.show()

import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
# cbar=True/False 为True则添加一个颜色棒(注:颜色棒必须在二元kde图像中才能生效)
x = np.random.randn(100)
y = np.random.randn(100)
sns.kdeplot(x, y, shade=True, color="red", cbar=True)
plt.show()

边栏推荐
- Introduction to uvm
- 分布式系统设计之高可用大全
- 10道集合框架面试题(含解析),来看看你会多少
- Why do big Internet companies keep hiring while frantically laying off staff?
- 分页组件的使用
- 【matlab】matlab中变量赋值函数deal
- 缓存存在的问题:缓存穿透、缓存击穿、缓存雪崩
- 补坑 模拟散列表
- tkinter-TinUI-xml combat (7) PDF paging and merging
- How to batch import files and rename them all to the same file name
猜你喜欢

结合实践总结docker 安装 mysql5.7

Completed - desktop interactive wizard design based on facial expressions (share the results, attach the data set of facial expressions and the yolov5 model trained by yourself and the interactive int

Runtime——KVC,KVO原理

【笔记工具】

梅科尔工作室-深度学习-BP神经网络

基于FTP协议的文件上传与下载

cnn convolutional neural network backpropagation, convolutional neural network dimension change

【分布式】链路追踪 jaeger

人体神经元细胞分布图片,神经元人体分布大图

【图像处理】matlab基础图像处理 | 图像载入、图像添加噪声、图像滤波、图像卷积
随机推荐
快要“金九银十”了,你开始准备了吗?
APISIX Ingress v1.5-rc1 released
数据库系统原理与应用教程(080)—— MySQL 练习题:操作题 186-193(二十四):综合练习
卷积神经网络的基本操作,卷积神经网络卷积计算
webstorage
【MySQL】——事务的基本概念
Neural network to solve what problem, neural network results is not stable
Tensorboard的使用 ---- SummaryWriter类(pytorch版)
docker修改mysql配置文件
最完整的分布式架构设计图谱
Introduction to uvm
分布式系统设计之高可用大全
测试与调试
Docker安装nacos2.0并指定mysql,安装sentinel
Web attack log analysis: a guide for beginners
Disadvantages of flex layout
Synchronization and Asynchrony of Clocks
Summary of digital IC design written test questions (4): some basic knowledge points
【RPC】Mercury RPC
Several postman features worth collecting will help you do more with less!