Python进行数据分析—可视化之seaborn
生活随笔
收集整理的這篇文章主要介紹了
Python进行数据分析—可视化之seaborn
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
安裝seaborn,可以使用?pip:
pip install seaborn也可以使用?conda:
conda install seaborn一個(gè)簡單的箱線圖:
import numpy as np import seaborn as sns import matplotlib.pyplot as pltsns.set(style="ticks")# Initialize the figure with a logarithmic x axis f, ax = plt.subplots(figsize=(7, 6)) ax.set_xscale("log")# Load the example planets dataset planets = sns.load_dataset("planets")# Plot the orbital period with horizontal boxes sns.boxplot(x="distance", y="method", data=planets,whis=np.inf, palette="vlag")# Add in points to show each observation sns.swarmplot(x="distance", y="method", data=planets,size=2, color=".3", linewidth=0)# Tweak the visual presentation ax.xaxis.grid(True) ax.set(ylabel="") sns.despine(trim=True, left=True)plt.show() # 記得show()一下
?
轉(zhuǎn)載于:https://www.cnblogs.com/douzujun/p/7734016.html
總結(jié)
以上是生活随笔為你收集整理的Python进行数据分析—可视化之seaborn的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python初步学习-查看文档及数据类型
- 下一篇: linux命令(8)wc