1.数据可视化概述
2.什么是数据可视化
数据可视化是借助图形化的手段将- -组 数据以图形的形式表示,并利用数据分析和开发工具发现其中未知信息的数据处理过程。数据可视化其实是一个抽象的过程,简单来说就是将一个不易描述的事物形成- 个可感知画面的过程,即从数据空间到图形空间的映射。
3.常见的数据可视化方式
折线图、柱形图、条形图、堆积图、直方图、箱型图、饼图、散点图、气泡图、误差棒图、雷达图、统计地图、3D图表
4.选择正确的数据可视化图表1.2 常见的数据可视化库
5.matplotlib概述
6.安装matplotib
7.使用matplotlib绘制图表
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(4,19)
y_min = np.array([32, 33, 34, 34, 33, 31, 30, 29, 30, 29, 26, 23, 21, 25, 31])
plt.plot(x, y_min)
plt.title("2020080603036")
plt.show()
x = np.arange(5)
y1 = np.array([10, 8, 7, 11, 13])
plt.bar(x, y1,width=0.4)
plt.title("2020080603036")
plt.show()
x = np.arange(4,19)
y_min = np.array([32, 33, 34, 34, 33, 31, 30, 29, 30, 29, 26, 23, 21, 25, 31])
y_max = np.array([35, 33, 34, 34, 33, 34, 30, 23, 30, 24, 26, 23, 24, 25, 31])
plt.plot(x, y_min)
plt.plot(x, y_max)
plt.title("2020080603036")
plt.show()
x = np.arange(5)
y1 =np.array([11, 8, 7, 5, 13])
y2 =np.array([3, 5, 6, 8, 16])
plt.bar(x, y1, width=0.4)
plt.bar(x + 0.4, y2, width=0.4)
plt.title("2020080603036")
plt.show()
error = [2, 4, 5, 2.4]
plt.bar(x, y1, width=0.3)
plt.bar(x,y1,bottom=y1,width=0.4)
plt.title("2020080603036")
plt.show()
y = np.arange(5)
x1 =np.array([11, 8, 7, 5, 13])
plt.barh(y, x1, height=0.4)
plt.title("2020080603036")
plt.show()
y = np.arange(5)
x1 =np.array([11, 8, 7, 5, 13])
x2 =np.array([3, 5, 6, 8, 16])
plt.barh(y, x1, height=0.4)
plt.barh(y+0.4, x2, height=0.4)
plt.title("2020080603036")
plt.show()
plt.barh(y, x1, height=0.4)
plt.barh(y, x2, left=x1, height=0.4)
plt.title("2020080603036")
plt.show()