一、分布数据可视化 - 直方图与密度图 displot() / kdeplot()/ rugplot() 加载模块,设置风格,尺度 import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns #设置风格,尺度 sns.set_style('darkgrid') sns.set_context('paper') #不发出警告 import warnings warnings.filterwarnings('ignore') 1.直方图 - distplot() 示例1: rs = np.random.RandomState(10) #设定随机数种子 s = pd.Series(rs.randn(100) * 100) sns.distplot(s, bins = 10, hist = True, kde = True, norm_hist = False, rug = True, vertical = True, color = 'b', label = 'distplot', axlabel = 'x') plt.legend() #bins ---> 箱数 #hist、ked ---> 是否显示箱/密度曲线 #norm_hist ---> 直方图是否按照密度来显示 #r