Seaborn 是对 matplotlib 的封装可增强
file - settings - priject
pip install --user --upgrade numpy -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install --user --upgrade pandas -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install --user --upgrade matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install --user --upgrade seaborn -i https://pypi.tuna.tsinghua.edu.cn/simple
python -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple
Traceback (most recent call last):
File "", line 1, in <module>
File "D:\58pycharm\file\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "D:\58pycharm\file\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "D:/space/pycharm/python03/demo03/d1.py", line 2, in <module>
import seaborn as sns
File "D:\58pycharm\file\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\86182\AppData\Roaming\Python\Python36\site-packages\seaborn\__init__.py", line 6, in <module>
from .rcmod import *
File "D:\58pycharm\file\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\86182\AppData\Roaming\Python\Python36\site-packages\seaborn\rcmod.py", line 7, in <module>
from . import palettes, _orig_rc_params
File "D:\58pycharm\file\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\86182\AppData\Roaming\Python\Python36\site-packages\seaborn\palettes.py", line 9, in <module>
from .utils import desaturate, set_hls_values, get_color_cycle
File "D:\58pycharm\file\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\86182\AppData\Roaming\Python\Python36\site-packages\seaborn\utils.py", line 6, in <module>
from scipy import stats
File "D:\58pycharm\file\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\86182\AppData\Roaming\Python\Python36\site-packages\scipy\__init__.py", line 104, in <module>
from . import _distributor_init
File "D:\58pycharm\file\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\86182\AppData\Roaming\Python\Python36\site-packages\scipy\_distributor_init.py", line 61, in <module>
WinDLL(os.path.abspath(filename))
File "D:\75python\file\lib\ctypes\__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] 找不到指定的模块。
pip install Shapely‑1.6.4.post2‑cp36‑cp36m‑win_amd64.whl -i https://pypi.tuna.tsinghua.edu.cn/simple
# Author:SFL
import seaborn as sns
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
def sinplot(flip=1):
# x 坐标:生成 ndarray ( 开始,结束,100 个数字 )
x = np.linspace(0, 14, 100)
# y 坐标
y = np.sin(x) * flip
plt.plot(x, y)
if __name__ == '__main__':
sinplot(2)
if __name__ == '__main__':
for i in range(6):
high = i + 1
sinplot(high)
if __name__ == '__main__':
sns.set()
for i in range(6):
high = i + 1
sinplot(high)
darkgrid :
whitegrid : 白色背景,有横线
dark : 灰色背景,没有线
white : 白色背景,没有线
ticks : 有坐标,没有线
if __name__ == '__main__':
sns.set_style("darkgrid")
for i in range(6):
high = i + 1
sinplot(high)
sns.set_style("whitegrid")
if __name__ == '__main__':
sns.set_style("ticks")
for i in range(6):
high = i + 1
sinplot(high)
sns.despine(left=False,bottom=False,top=True,right=True)
res = np.arange(6)
结果 : [0,1,2,3,4,5]