引言
最近重新学习了下matplotlib,紧接着看到了seaborn,于是也一起串了一下。
seaborn是啥?能干啥?
Seaborn is a Python data visualization library based on matplotlib. It provides a high-level interface for drawing attractive and informative statistical graphics.
seaborn 是 基于matplotlib的 更高级的API库。
目的是: 绘制 更有吸引力、信息更丰富的统计图。
seaborn 能绘制哪些种/种类的图?
seaborn tutorial
如上:大致分类3类:
-
关联类(散点图、折线图,看整体的趋势,考察数据间有否有关联)
-
分布类(直方图,密度图,累计分布图,考察数据的分布是均匀、集中好是稀疏)
-
类别类 (箱型图,小提琴图等,考察标签类数据的多类别与其他数据间相关性及分布)
Categorical scatterplots:
stripplot() (with kind=“strip”; the default)
swarmplot() (with kind=“swarm”)
Categorical distribution plots:
boxplot() (with kind=“box”)
violinplot() (with kind=“violin”)
boxenplot() (with kind=“boxen”)
Categorical estimate plots:
pointplot() (with kind=“point”)
barplot() (with kind=“bar”)
countplot() (with kind=“count”)
上述均是只涉及单变量、双变量的作图,多变量的作图用 jointplot() 和 pairplot()
除此之外还包含:
- 回归图
- 热力图
seaborn API 列表
从来见过这么简单明了的API,值得一看,文档例子都有。