Python-Seaborn
0 引言
Seaborn 是基于 matplotlib 开发的高阶 Python 数据可视图库,用于绘制优雅、美观的统计图形。
和 NumPy, SciPy, Pandas, Matplotlib 一样,要用 Seaborn,首先引用其库并起别名为 sns。
import seaborn as sns
本文还用到其他的库,声明如下。
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
%matplotlib inline
from datetime import datetime
np.random.seed(1031)
个人偏好百度 Echarts 里面的一组颜色,因此将其 hex 颜色代码定义出来,其中红色的 r_hex 和深青色的 dt_hex 是大爱。
r_hex = '#dc2624' # red, RGB = 220,38,36
dt_hex = '#2b4750' # dark teal, RGB = 43,71,80
tl_hex = '#45a0a2' # teal, RGB = 69,160,162
r1_hex = '#e87a59' # red, RGB = 232,122,89
tl1_hex = '#7dcaa9' # teal, RGB = 125,202,169
g_hex = '#649E7D' # green, RGB = 100,158,125
o_hex