首先 ,我們應該瞭解什麼是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()
如果你有更好的辦法一定要下方評論呀
總結
我認爲計算機是最會表達自己的,你給了他正確的,他就會回饋給你正確的;你給了他錯誤的,他就告訴你錯哪了,等着你給他正確的。每一次報錯,可都是計算機情感的真實流露,可別辜負了人家的一番好意。