Seaborn-PairGrid

本文详细介绍Seaborn库中的pairplot函数用法,包括参数解释及实例展示。通过不同类型的图表展示数据间的关联性,如散点图、回归图等,并支持自定义颜色、标记等。
部署运行你感兴趣的模型镜像

seaborn.pairplot

  • 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)

Parameters:

  • data : DataFrame
    Tidy (long-form) dataframe where each column is a variable and each row is an observation.
  • hue : (根据某一类别进行分类,比如code)string (variable name), optional
    Variable in data to map plot aspects to different colors.
  • hue_order : list of strings
    Order for the levels of the hue variable in the palette
  • palette : dict or seaborn color palette
    Set of colors for mapping the hue variable. If a dict, keys should be values in the hue variable.
  • vars : **DataFrame列名称**list of variable names, optional
    Variables within data to use, otherwise use every column with a numeric datatype.
    {x, y}_vars : lists of variable names, optional
    Variables within data to use separately for the rows and columns of the figure; i.e. to make a non-square plot.
    -* kind* : {‘scatter’, ‘reg’}, optional
    Kind of plot for the non-identity relationships.
  • diag_kind : (对脚线图形的种类){‘hist’, ‘kde’}, optional
    Kind of plot for the diagonal subplots.
  • markers : single matplotlib marker code or list, optional
    Either the marker to use for all datapoints or a list of markers with a length the same as the number of levels in the hue variable so that differently colored points will also have different scatterplot markers.
  • size : scalar, optional
    Height (in inches) of each facet.
  • aspect : scalar, optional
    Aspect * size gives the width (in inches) of each facet.
  • dropna : boolean, optional
    Drop missing values from the data before plotting.
    {plot, diag, grid}_kws : dicts, optional
    Dictionaries of keyword arguments.
%matplotlib inline
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
sns.set_style('darkgrid')
f,axes=plt.subplots(3,3,figsize=(9,9),sharex=True,sharey=True)

stock=pd.read_csv('sample.csv',index_col=0)
sns.kdeplot(stock.open,stock.high)
<matplotlib.axes._subplots.AxesSubplot at 0x3ad9e748>

sns.boxplot(stock.open,stock.high)
<matplotlib.axes._subplots.AxesSubplot at 0x277f22e8>

sns.lmplot(x='ma10',y='ma20',data=stock)
<seaborn.axisgrid.FacetGrid at 0x31245dd8>

sns.jointplot('ma10','price_change',data=stock,kind='reg')
<seaborn.axisgrid.JointGrid at 0x31c85898>

g=sns.pairplot(stock.ix[:,5:10])

sns.pairplot(stock.ix[:,10:],hue='code')
<seaborn.axisgrid.PairGrid at 0x5a860a20>

vars=['ma5','ma10','v_ma5']
sns.pairplot(stock,vars=vars,hue='code',size=5,kind='scatter',diag_kind='kde',diag_kws=dict(shade=True))
<seaborn.axisgrid.PairGrid at 0x6fc2ee10>

sns.pairplot(stock,vars=vars,hue='code',size=5,kind='scatter',plot_kws=dict(s=50, edgecolor="b", linewidth=1),diag_kind='kde',diag_kws=dict(shade=True))
<seaborn.axisgrid.PairGrid at 0x71608588>

您可能感兴趣的与本文相关的镜像

Seed-Coder-8B-Base

Seed-Coder-8B-Base

文本生成
Seed-Coder

Seed-Coder是一个功能强大、透明、参数高效的 8B 级开源代码模型系列,包括基础变体、指导变体和推理变体,由字节团队开源

评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值