Python数据可视化|python 数据可视化01

一.学习的内容
1.什么是数据可视化
数据可视化主要旨在借助于图形化手段,清晰有效地传达与沟通信息。
2.使用matplotlib绘制简单图表
(1)折线图

import numpy as np import matplotlib.pyplot as plt x = np.arange(4,19) y_max = np.array([32,33,34,34,33,31,30,29,30,29,26,23,21,25,31]) y_min = np.array([19,19,20,22,22,21,22,16,18,18,17,14,15,16,16]) plt.plot(x,y_max) plt.plot(x,y_min) plt.title("2020080603043") plt.show()

Python数据可视化|python 数据可视化01
文章图片

(2)柱形图
import numpy as np import matplotlib.pyplot as plt x=np.arange(5) y1= np.array([10,8,7,11,13]) bar_width = 0.3 plt.bar(x,y1,tick_label=['a','b', 'c', 'd','e'], width=bar_width) plt.title("2020080603043") plt.show()

Python数据可视化|python 数据可视化01
文章图片

(3)多组柱形图
import numpy as np import matplotlib.pyplot as plt x =np.arange(5) y1= np.array([10,8,7,11,13]) y2= np.array([9,6,5,10,12]) bar_width = 0.3 plt.bar(x,y1,tick_label=['a','b', 'c', 'd','e'], width=bar_width) plt.bar(x+bar_width,y2,width=bar_width) plt.title("2020080603043") plt.show()

Python数据可视化|python 数据可视化01
文章图片

(4)堆积柱形图
import numpy as np import matplotlib.pyplot as plt plt.bar(x,y1,tick_label=['a','b','c','d','e'], width=bar_width) plt.bar(x,y2,bottom =y1, width=bar_width) plt.title("2020080603043") plt.show()

Python数据可视化|python 数据可视化01
文章图片

(5)条形图
import numpy as np import matplotlib.pyplot as plt y = np.arange(5) x1= np.array([10,8,7,11,13]) bar_height =0.3 plt.barh(y,x1,tick_label=['a','b','c','d','e'],height=bar_height) plt.title("2020080603043") plt.show()

Python数据可视化|python 数据可视化01
文章图片

(6)堆积条形图
y = np.arange(5) x1= np.array([10,8,7,11,13]) x2=np.array([9,6,5,10,12]) bar_height =0.3 plt.barh(y,x1,tick_label=['a','b','c','d','e'],height=bar_height) plt.barh(y+bar_height,x2,height=bar_height) plt.title("2020080603043") plt.show()

Python数据可视化|python 数据可视化01
文章图片

(7)多组条形图
+ y = np.arange(5) x1= np.array([10,8,7,11,13]) x2=np.array([9,6,5,10,12]) bar_height =0.3 plt.barh(y,x1,tick_label=['a','b','c','d','e'],height=bar_height) plt.barh(y+bar_height,x2,height=bar_height) plt.title("2020080603043") plt.show()

【Python数据可视化|python 数据可视化01】Python数据可视化|python 数据可视化01
文章图片

    推荐阅读