气温随时间变化的规律
为寻找当地气温随时间变化的规律,对四十天内气温的变化进行统计得到如下数组:
[32, 25, 15, 19, 18, 23, 27, 23, 24, 24, 24, 25, 17, 17, 17, 22, 26, 27, 28, 28, 20, 17, 19, 19, 23, 19, 19, 23, 24, 26, 27, 28, 28, 29, 26, 27, 29, 30, 29, 29]
from matplotlib import pyplot as plt
import matplotlib
matplotlib.rc("font",family='FangSong')
temperature_1 = [32, 25, 15, 19, 18, 23, 27, 23, 24, 24, 24, 25, 17, 17, 17, 22, 26, 27, 28, 28, 20, 17, 19, 19, 23, 19, 19, 23, 24, 26, 27, 28, 28, 29, 26, 27, 29, 30, 29, 29]
temperature_2 = [24, 17, 15, 20, 18, 21, 23, 23, 23, 23, 24, 22, 17, 18, 17, 20, 24, 27, 29, 28, 17, 17, 21, 22, 25, 21, 20, 23, 25, 23, 27, 29, 29, 28, 24, 26, 29, 30, 27, 25]
count = 0
for i in temperature_1:
count +=1
x = range(1,count+1,1)
y_1 = temperature_1
y_2 = temperature_2
_xticks_labels = ["第{}日".format(i) for i in x]
plt.xticks(x[::3], _xticks_labels[::3], rotation=45)
plt.grid(alpha=0.3)
plt.scatter(x, y_1, label="临汾")
plt.scatter(x, y_2, label=