import seaborn as sns
import numpy as np
import matplotlib as mpl
import matplotlib. pyplot as plt
import pandas as pd
import warnings
warnings. filterwarnings( "ignore" )
sns. set ( color_codes = True )
np. random. seed( sum ( map ( ord , "distributions" ) ) )
tips = sns. load_dataset( "tips" )
titanic = sns. load_dataset( "titanic" )
sns. stripplot( x = "day" , y = "total_bill" , data = tips, jitter= True )
<matplotlib.axes._subplots.AxesSubplot at 0x2cec641e780>
sns. swarmplot( x = "day" , y = "total_bill" , data = tips, hue = "sex" )
<matplotlib.axes._subplots.AxesSubplot at 0x2cec7867c50>
sns. boxplot( x = "day" , y = "total_bill" , hue = "time" , data = tips)
<matplotlib.axes._subplots.AxesSubplot at 0x2cec78c9dd8>
sns. barplot( x = "sex" , y = "survived" , hue = "class" , data = titanic)
<matplotlib.axes._subplots.AxesSubplot at 0x2cec79917f0>
sns. pointplot( x = "sex" , y = "survived" , hue = "class" , data = titanic)
<matplotlib.axes._subplots.AxesSubplot at 0x2cec79f4b00>
sns. factorplot( x = "day" , y = "total_bill" , hue = "smoker" , data = tips)
<seaborn.axisgrid.FacetGrid at 0x2cec7aa9b00>
sns. factorplot( x = "day" , y = "total_bill" , hue = "smoker" ,
col = "time" , data = tips, kind = "swarm" )
<seaborn.axisgrid.FacetGrid at 0x2cec7984cc0>
seaborn.factorplot(x=None, y=None, hue=None, data=None, row=None, col=None, col_wrap=None, estimator=, ci=95, n_boot=1000, units=None, order=None, hue_order=None, row_order=None, col_order=None, kind=‘point’, size=4, aspect=1, orient=None, color=None, palette=None, legend=True, legend_out=True, sharex=True, sharey=True, margin_titles=False, facet_kws=None, **kwargs)
Parameters:
x,y,hue 数据集变量 变量名 date 数据集 数据集名 row,col 更多分类变量进行平铺显示 变量名 col_wrap 每行的最高平铺数 整数 estimator 在每个分类中进行矢量到标量的映射 矢量 ci 置信区间 浮点数或None n_boot 计算置信区间时使用的引导迭代次数 整数 units 采样单元的标识符,用于执行多级引导和重复测量设计 数据变量或向量数据 order, hue_order 对应排序列表 字符串列表 row_order, col_order 对应排序列表 字符串列表 +kind : 可选:point 默认, bar 柱形图, count 频次, box 箱体, violin 提琴, strip 散点,swarm 分散点 size 每个面的高度(英寸) 标量 aspect 纵横比 标量 orient 方向 “v”/“h” color 颜色 matplotlib颜色 palette 调色板 seaborn颜色色板或字典 legend hue的信息面板 True/False legend_out 是否扩展图形,并将信息框绘制在中心右边 True/False share{x,y} 共享轴线 True/False