【四二學堂】Python數據可視化-線性圖

Python數據可視化視頻課程網址:
https://edu.csdn.net/course/detail/29085
在這裏插入圖片描述

import matplotlib.pyplot as plt
import numpy as np

plt.rcParams['font.sans-serif'] = ['Microsoft YaHei']  #識別漢字

x = np.linspace(0, 2, 50)  #代表當前網線上有的點的number(0,2)代表x方向的起止位置 分爲50份

plt.plot(x, x, label='北京')  # Plot some data on the (implicit) axes.
plt.plot(x, x**2, label='上海')  # etc.
plt.plot(x, x**3, label='天津')
plt.xlabel('空氣質量參數')
plt.ylabel('變化幅度')
plt.title('污染提升變化')

plt.legend()  #圖例,說明解釋

plt.show()

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章