matplotlib.cm
- matplotlib.cm是matplotlib库中内置的色彩映射函数。官网解释
- 语法:matplotlib.cm.[色彩] ([数据集]) 即对[数据集]应用[色彩]
- 示例:
plt.cm.Set1(i)
plt.cm.nipy_spectral
- 结果:(0.21568627450980393, 0.49411764705882355, 0.7215686274509804, 1.0)
- 备注:颜色可用元组表示,元组由4各元素组成,每个元素范围在[0,1]之间。eg:(0,0,0,0);(255,255,255,255)。
色彩集
cmaps = [('Perceptually Uniform Sequential', [
'viridis', 'plasma', 'inferno', 'magma', 'cividis']),
('Sequential', [
'Greys', 'Purples', 'Blues', 'Greens', 'Oranges', 'Reds',
'YlOrBr', 'YlOrRd', 'OrRd', 'PuRd', 'RdPu', 'BuPu',
'GnBu', 'PuBu', 'YlGnBu', 'PuBuGn', 'BuGn', 'YlGn']),
('Sequential (2)', [
'binary', 'gist_yarg', 'gist_gray', 'gray', 'bone', 'pink',
'spring', 'summer', 'autumn', 'winter', 'cool', 'Wistia',
'hot', 'afmhot', 'gist_heat', 'copper']),
('Diverging', [
'PiYG', 'PRGn', 'BrBG', 'PuOr', 'RdGy', 'RdBu',
'RdYlBu', 'RdYlGn', 'Spectral', 'coolwarm', 'bwr', 'seismic']),
('Cyclic', ['twilight', 'twilight_shifted', 'hsv']),
('Qualitative', [
'Pastel1', 'Pastel2', 'Paired', 'Accent',
'Dark2', 'Set1', 'Set2', 'Set3',
'tab10', 'tab20', 'tab20b', 'tab20c']),
('Miscellaneous', [
'flag', 'prism', 'ocean', 'gist_earth', 'terrain', 'gist_stern',
'gnuplot', 'gnuplot2', 'CMRmap', 'cubehelix', 'brg',
'gist_rainbow', 'rainbow', 'jet', 'turbo', 'nipy_spectral',
'gist_ncar'])]
seaborn.lmplot
- snm,lmplot是用来绘制回归图的。官方解释
- 建立的回归模型不一定是直线,也可以设置多项式模型。order:(可选)此参数的阶数大于1,控制进行回归的幂次(一次以上即是多项式回归)。
- 部分参数详解。
- seaborn.set_style()使用5种默认风格
pickle
- pickle包的作用是模型加载和导出
- import pickle
- 语法:pickle.dump(model, 文件名) – 导出;
pickle.load( 文件名) – 导入;