在此之前:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.style as psl
psl.use('seaborn-colorblind')
%matplotlib inline
print('导入完成!')
方式一:
test = pd.Series(np.random.normal(loc = 2000,scale = 200,size = 120))
print(type(test))
plt.hist(test,bins= 30)
方式二:
def bonus(b_avg):
return pd.Series(np.random.normal(loc = b_avg,scale = 200,size = 120))
print(bonus(1500)[:10])
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
plt.hist(bonus(1500),bins = 30)
plt.grid()
关于matplotlib 绘图案例,请听下次分享;
|