Seaborn-PairGrid
2016-05-31 21:08
2086 查看
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)
![](http://i.imgur.com/ZFMfzRa.png)
stock=pd.read_csv('sample.csv',index_col=0) sns.kdeplot(stock.open,stock.high)
<matplotlib.axes._subplots.AxesSubplot at 0x3ad9e748>
![](http://i.imgur.com/xU7gTgj.png)
sns.boxplot(stock.open,stock.high)
<matplotlib.axes._subplots.AxesSubplot at 0x277f22e8>
![](http://i.imgur.com/A3fl9Qm.png)
sns.lmplot(x='ma10',y='ma20',data=stock)
<seaborn.axisgrid.FacetGrid at 0x31245dd8>
![](http://i.imgur.com/F8wZUOl.png)
sns.jointplot('ma10','price_change',data=stock,kind='reg')
<seaborn.axisgrid.JointGrid at 0x31c85898>
![](http://i.imgur.com/unMVJbP.png)
g=sns.pairplot(stock.ix[:,5:10])
![](http://i.imgur.com/2OvonU3.png)
sns.pairplot(stock.ix[:,10:],hue='code')
<seaborn.axisgrid.PairGrid at 0x5a860a20>
![](http://i.imgur.com/JZ3QwEJ.png)
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>
![](http://i.imgur.com/kGmSdiy.png)
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>
![](http://i.imgur.com/nw3EwKI.png)
相关文章推荐
- grails指定端口运行工程
- [LeetCode]problem 70. Climbing Stairs
- HDOJ--Fibonacci Again
- Middle-题目122:220. Contains Duplicate III
- 1079. Total Sales of Supply Chain (25)
- leetcode 217. Contains Duplicate
- 1282 - Leading and Trailing ---LightOj1282(快速幂 + 数学)
- 【BZOJ1664】[Usaco2006 Open]County Fair Events 参加节日庆祝【线段覆盖】【贪心】
- Palindrome Pairs
- poj 3378 Crazy Thairs
- 【cf】Restoring Paintie
- [Ruby On Rails] Action Controller - 控制HTTP 流程
- poj 3378 Crazy Thairs
- TortoiseGit安装图解以及(no supported authentication methods avaiable)问题解决
- ORA-02291: integrity constraint: parent key not found
- 第15课:Spark Streaming源码解读之No Receivers彻底思考
- Paint的效果研究
- Codeforces Round #353 (Div. 2) E. Trains and Statistic
- Middle-题目31:11. Container With Most Water
- 机器学习&人工智能书籍