from matplotlib import pyplot as plt
plt.rcParams['font.sans-serif']=['SimHei']
plt.rcParams['axes.unicode_minus']=False
y_a = [11,17,16,11,12,11,12,6,6,7,8,9,12,15,14,17,18,21,16,17,20,14,15,15,15,19,21,22,22,22,23]
y_b = [26,26,28,19,21,17,16,19,18,20,20,19,22,23,17,20,21,20,22,15,11,15,5,13,17,10,11,13,12,13,6]
x_a = range(1,len(a)+1)
x_b = range(len(a)+11,len(a)+42)
plt.figure(figsize = (20,12),dpi = 100)
plt.scatter(x_a,y_a,c = 'm',label ="三月")
plt.scatter(x_b,y_b,color = 'y',label = "十月")
x = list(x_a)+list(x_b)
xlabel = ["3月{}日".format(i) for i in x_a]
xlabel += ["10月{}日".format(i-41) for i in x_b]
plt.xticks(x[::3],xlabel[::3])
plt.xlabel("月份")
plt.ylabel("气温,摄氏度")
plt.title("某市三月、十月最高气温")
plt.legend(loc = 2)
plt.savefig("scatter.png")
plt.show()
