美文网首页pythonseabornseaborn
Seaborn-05-Pairplot多变量图

Seaborn-05-Pairplot多变量图

作者: longgb246 | 来源:发表于2016-11-21 11:55 被阅读4448次
#-*- coding:utf-8 -*-
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
seaborn.pairplot(data, hue=None, hue_order=None, palette=None, vars=None, x_vars=None, y_vars=None, kind='scatter', diag_kind='hist', markers=None, size=2.5, aspect=1, dropna=True, plot_kws=None, diag_kws=None, grid_kws=None)¶
数据指定:

vars : 与data使用,否则使用data的全部变量。参数类型:numeric类型的变量list。
{x, y}_vars : 与data使用,否则使用data的全部变量。参数类型:numeric类型的变量list。
dropna : 是否剔除缺失值。参数类型:boolean, optional

特殊参数:

kind : {‘scatter’, ‘reg’}, optional Kind of plot for the non-identity relationships.
diag_kind : {‘hist’, ‘kde’}, optional。Kind of plot for the diagonal subplots.

基本参数:

size : 默认 6,图的尺度大小(正方形)。参数类型:numeric
hue : 使用指定变量为分类变量画图。参数类型:string (变量名)
hue_order : list of strings Order for the levels of the hue variable in the palette
palette : 调色板颜色
markers : 使用不同的形状。参数类型:list
aspect : scalar, optional。Aspect * size gives the width (in inches) of each facet.
{plot, diag, grid}_kws : 指定其他参数。参数类型:dicts

返回:

PairGrid 对象

1、散点图

sns.set(style="ticks", color_codes=True)
iris = sns.load_dataset("iris")
g = sns.pairplot(iris)
05_01.png

2、指定分类变量的,散点图

g2 = sns.pairplot(iris, hue="species")
05_05.png
使用调色板
g3 = sns.pairplot(iris, hue="species", palette="husl")
05_06.png
使用不同的形状
g4 = sns.pairplot(iris, hue="species", markers=["o", "s", "D"])
05_07.png

3、改变对角图

使用 KDE
g5 = sns.pairplot(iris, diag_kind="kde")
05_03.png
使用回归
g6 = sns.pairplot(iris, kind="reg")
05_04.png

4、改变点形状,使用参数,使用 edgecolor

g7 = sns.pairplot(iris, diag_kind="kde", markers="+",
                  plot_kws=dict(s=50, edgecolor="b", linewidth=1),
                  diag_kws=dict(shade=True))
05_02.png

相关文章

  • Seaborn-05-Pairplot多变量图

    seaborn.pairplot(data, hue=None, hue_order=None, palette=...

  • R语言生存分析02-ggforest

    Cox 风险比例模型绘制森林图 coxph函数构建公式,公式包括生存对象和纳入多因素cox的变量,注意变量可以是分...

  • 3.1 php的变量在计算机中的储存方式

    变量的定义 变量,重复操作同一数据需要用到变量,变量是数据的容器。 计算机关系图 变量内存图

  • 基于CollectionView的瀑布流

    效果图,变量多基于随机数 需实现方法: Demo地址:https://github.com/CyanSmile/C...

  • python matplotlib(pymatplotlib)

    堆叠柱形图 并列柱形图 水平柱形图 破损柱形图 分类变量图 堆叠柱形图 并列柱形图 水平柱形图 破损柱形图 分类变量图

  • 第三章:数据的描述

    3.1.1 定量变量的图表示:直方图、盒形图、茎叶图、散点图。 3.1.2 定性变量的图表示:饼图和条形图。 3....

  • 在线作图|如何绘制一张变量相关图(PCA)

    变量相关图(PCA) 变量相关图(Variables - PCA)将PCA主成分分析与变量相结合,通过在同一坐标轴...

  • 绘图常用

    matplotlib 分类变量 饼图 箱型图 lgb

  • 2019-08-21

    对于定性变量,常常根据变量的分类类型来分组,可以采用饼图和条形图来描述定性变量的分布。 3.2.2对比分析 (1)...

  • Seaborn-03-数据分布图

    基本 1、快速查看分布 distplot 2、画单变量图 3、画二元变量分布图 (1)散点图 (2)六边图 (3)...

网友评论

    本文标题:Seaborn-05-Pairplot多变量图

    本文链接:https://www.haomeiwen.com/subject/enkupttx.html