1、数据可视化呈现的最基础图形就是:柱状图、水平条形图、折线图等等;
在python的matplotlib库中分别可用bar、barh、plot函数来构建它们,再使用xticks与yticks(设置坐标轴刻度)、
xlabel与ylabel(设置坐标轴标签)、title(标题)、legend(图例)、xlim与ylim(设置坐标轴数据范围)、
grid(设置网格线)等命令来装饰图形
import matplotlib.pyplot as plt
import numpy as np
#创建带数字标签的直方图
numbers = list(range(1,11))
#np.array()将列表转换为存储单一数据类型的多维数组
x = np.array(numbers)
y = np.array([a**2 for a in numbers])
plt.bar(x,y,width=0.5,align='center',color='c')
plt.title('Square Numbers',fontsize=24)
plt.xlabel('Value',fontsize=14)
plt.ylabel('Square of Value',fontsize=14)
plt.tick_params(axis='both',labelsize=14)
plt.axis([0,11,0,110])
for a,b in zip(x,y):
plt.text(a,b+0.1,'%.0f'%b,ha = 'center',va