python数据可视化pandas绘图函数直方图函数
#!/usr/bin/env python# -*- coding:utf-8 -*-# Author's_name_is_NIKOLA_SS# 直方图---所有数据from pandas import Seriesimport numpy as npfrom matplotlib import pyplot as pltfrom pylab import mplmpl.rcParams['fon
·
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author's_name_is_NIKOLA_SS
# 直方图---所有数据
from pandas import Series
import numpy as np
from matplotlib import pyplot as plt
from pylab import mpl
mpl.rcParams['font.sans-serif'] = ['FangSong'] # 指定‘仿宋’字体
hist_data = Series([2, 2, 4, 5, 2, 4, 3, 4, 6, 5])
# 自定义分组
mybins = [1, 3, 5, 7]
hist_data.plot(kind='hist', bins=mybins) # 横坐标是分组,纵坐标是频率
plt.title('频率分布图')
plt.show()
更多推荐
已为社区贡献8条内容
所有评论(0)