seaborn
来源:互联网 发布:网络大神小说排行榜 编辑:程序博客网 时间:2024/05/24 06:06
%matplotlib inline
import pandas as pdimport numpy as npimport seaborn as snsfrom sklearn import preprocessingimport matplotlib.pyplot as pltnp.random.seed(sum(map(ord, "aesthetics")))def sinplot(flip=1): x=np.linspace(0,14,100) for i in range(1,7): plt.plot(x,np.sin(x+i*.5)*(7-i)*flip)sinplot()
![png](output_1_0.png)sns.set_style('whitegrid')data=np.random.normal(size=(20,6))+np.arange(6)/2sns.boxplot(data=data)
stock=pd.read_csv('sample.csv',index_col=0)ohcl=stock.ix[:15,:4][::-1].Tsns.boxplot(ohcl)
# set_style()sns.set_style("dark")sns.boxplot(ohcl)
sns.set_style("ticks",{'xtick.direction': u'out'})sns.boxplot(ohcl)sns.despine()
![png](output_6_0.png)sns.violinplot(ohcl,palette="deep")sns.despine(offset=10,trim=True,left=True)
![png](output_7_0.png)sns.axes_style()
{‘axes.axisbelow’: True, ‘axes.edgecolor’: ‘.15’, ‘axes.facecolor’: ‘white’, ‘axes.grid’: False, ‘axes.labelcolor’: ‘.15’, ‘axes.linewidth’: 1.25, ‘figure.facecolor’: ‘white’, ‘font.family’: [u’sans-serif’], ‘font.sans-serif’: [u’Arial’, u’Liberation Sans’, u’Bitstream Vera Sans’, u’sans-serif’], ‘grid.color’: ‘.8’, ‘grid.linestyle’: u’-‘, ‘image.cmap’: u’Greys’, ‘legend.frameon’: False, ‘legend.numpoints’: 1, ‘legend.scatterpoints’: 1, ‘lines.solid_capstyle’: u’round’, ‘text.color’: ‘.15’, ‘xtick.color’: ‘.15’, ‘xtick.direction’: u’out’, ‘xtick.major.size’: 6.0, ‘xtick.minor.size’: 3.0, ‘ytick.color’: ‘.15’, ‘ytick.direction’: u’out’, ‘ytick.major.size’: 6.0, ‘ytick.minor.size’: 3.0}sns.set_context('talk') #notebook ,poster,talksns.boxplot(ohcl)
sns.set_style('darkgrid')sns.regplot(x=stock.volume,y=stock.ma10,logx=True,x_estimator=np.mean)
sns.lmplot(x='ma5',y='ma20',data=stock,aspect=.5)sns.lmplot(x='ma5',y='ma20',data=stock,aspect=.5)
sns.jointplot(x='ma10',y='price_change',data=stock,kind='reg')#{ "scatter" | "reg" | "resid" | "kde" | "hex" }, optional
sns.jointplot(x='ma10',y='price_change',data=stock,kind='kde')
sns.jointplot(x='ma10',y='price_change',data=stock,kind='resid')
sns.jointplot(x='ma10',y='price_change',data=stock,kind='hex')
sns.jointplot(x='ma10',y='price_change',data=stock,kind='scatter')
titanic = sns.load_dataset("titanic")tips = sns.load_dataset("tips")iris = sns.load_dataset("iris")tips
244 rows × 7 columns
sns.stripplot(x='day',y='total_bill',data=tips)
<matplotlib.axes._subplots.AxesSubplot at 0x42fce940>
sns.stripplot(x='day',y='total_bill',data=tips,jitter=True)
<matplotlib.axes._subplots.AxesSubplot at 0x430546a0>
sns.swarmplot(x='day',y='total_bill',data=tips)
<matplotlib.axes._subplots.AxesSubplot at 0x4235d860>
sns.swarmplot(x='day',y='total_bill',hue='sex',data=tips)
<matplotlib.axes._subplots.AxesSubplot at 0x43503b00>
sns.swarmplot(x='size',y='total_bill',data=tips)
<matplotlib.axes._subplots.AxesSubplot at 0x435c7d30>
sns.swarmplot(x='total_bill',y='day',hue='time',data=tips)
<matplotlib.axes._subplots.AxesSubplot at 0x3e010828>
sns.boxplot(x='day',y='total_bill',data=tips)
<matplotlib.axes._subplots.AxesSubplot at 0x3e1b2240>
hs_stock=pd.read_csv('hs_stock.csv',index_col=0)sns.boxplot(x='code',y='ma10',data=hs_stock)
<matplotlib.axes._subplots.AxesSubplot at 0x517754e0>
sns.violinplot(x="total_bill", y="day", hue="time", data=tips);
sns.violinplot(x="total_bill", y="day", hue="time", data=tips, bw=.1, scale="count", scale_hue=False);
sns.violinplot(x="day", y="total_bill", hue="sex", data=tips, split=True);
sns.violinplot(x="day", y="total_bill", data=tips, inner=None)sns.swarmplot(x="day", y="total_bill", data=tips, color="w", alpha=.5);
sns.barplot(x="sex", y="survived", hue="class", data=titanic);
sns.countplot(x="deck", data=titanic, palette="Greens_d");
sns.factorplot(x="day", y="total_bill", hue="smoker", data=tips);
sns.factorplot(x="day", y="total_bill", hue="smoker", data=tips, kind="bar");
sns.factorplot(x="day", y="total_bill", hue="smoker", col="time", data=tips, kind="swarm");
sns.factorplot(x="time", y="total_bill", hue="smoker", col="day", data=tips, kind="box", size=4, aspect=.5);
g = sns.PairGrid(tips, x_vars=["smoker", "time", "sex"], y_vars=["total_bill", "tip"], aspect=.75, size=3.5)g.map(sns.violinplot, palette="pastel");
ohls=hs_stock.ix[:3000,:]g=sns.FacetGrid(ohls,col='code')g.map(sns.boxplot,'open',"ma5")g.add_legend()
<seaborn.axisgrid.FacetGrid at 0x660e4f28>
gk=sns.PairGrid(ohls.ix[:,:9])gk.map(plt.scatter)
<seaborn.axisgrid.PairGrid at 0xaa438828>
0 0
- Seaborn
- seaborn
- Seaborn
- Seaborn使用说明
- Seaborn-PairGrid
- Seaborn初探
- Seaborn教程
- Seaborn绘图
- seaborn散点图
- Python数据可视化-seaborn Seaborn
- seaborn 的使用
- seaborn ——Jointplot
- seaborn简单使用
- Seaborn-01-图控制
- seaborn的画图
- Matplotlib进阶:Seaborn教程
- python seaborn画图
- seaborn, 数据可视化工具
- SQL的定义与使用
- 1087. All Roads Lead to Rome (30) PAT
- 【Tesseract】Tesseract API在VS 2013中的配置以及调用
- C#中的多文档界面与多窗体界面
- 一些可能有用的网址
- seaborn
- php curl get和post
- JS for与for in对比(包含性能测试)
- java基础学习笔记 -- OOP知识点备忘
- Android PopupWindow的使用和分析
- CodeForces 148D Bag of mice 概率DP
- 长周末结束
- 链表-Remove Nth Node From End of List(删除指定的节点)
- 第十四周项目—阅读并运行程序,解释程序执行得到的结果(2)