首先 ,我们应该了解什么是seaborn
Project description
Seaborn is a library for making statistical graphics in Python. It is built on top of matplotlib and closely integrated with pandas data structures.
Here is some of the functionality that seaborn offers:
- A dataset-oriented API for examining relationships between multiple variables
- Specialized support for using categorical variables to show observations or aggregate statistics
- Options for visualizing univariate or bivariate distributions and for comparing them between subsets of data
- Automatic estimation and plotting of linear regression models for different kinds dependent variables
- Convenient views onto the overall structure of complex datasets
- High-level abstractions for structuring multi-plot grids that let you easily build complex visualizations
- Concise control over matplotlib figure styling with several built-in themes
- Tools for choosing color palettes that faithfully reveal patterns in your data
Seaborn aims to make visualization a central part of exploring and understanding data. Its dataset-oriented plotting functions operate on dataframes and arrays containing whole datasets and internally perform the necessary semantic mapping and statistical aggregation to produce informative plots.
这是官网上的介绍。
好吧,他全是英文,大概意思就是你可以使用他轻松构建复杂的可视化 。
我们进入正题anaconda 安装seaborn。
1、在开始菜单中找到Anaconda3文件夹中的“Anaconda Prompt ”
2、打开“Anaconda Prompt”
3、输入“conda install seaborn”
4、等一小会,出现下图,输入“y”
5、然后进行比较漫长的等待
A long time later.时间不是有点长呀。。。
6、等了一会之后,他给报了错,相这样的
7、报了错,是好事,不要慌,看看他给咱们提示了什么。我理解哈,大概意思是让咱们通过网址自己下载,,看见这个< >中间有https开头到bz2结尾的把它一个一个的下载下来。下载下来,放在放在anaconda文件夹下,也不用解压。
8、之后再输入“conda install seaborn”再从头走一遍。
9、我们可有输入代码验证是否成功
import matplotlib.pyplot as plt
import scipy.stats as stats
lower, upper = 3.5, 6
mu, sigma = 5, 0.7
X = stats.truncnorm(
(lower - mu) / sigma, (upper - mu) / sigma, loc=mu, scale=sigma)
N = stats.norm(loc=mu, scale=sigma)
fig, ax = plt.subplots(2, sharex=True)
ax[0].hist(X.rvs(10000), normed=True)
ax[1].hist(N.rvs(10000), normed=True)
plt.show()
总结
我认为计算机是最会表达自己的,你给了他正确的,他就会回馈给你正确的;你给了他错误的,他就告诉你错哪了,等着你给他正确的。每一次报错,可都是计算机情感的真实流露,可别辜负了人家的一番好意。