from matplotlib import pyplot as plt
import numpy as num
import pandas as pd
import random
from matplotlib import font_manager
my_font = font_manager.FontProperties(fname="C:\\Windows\\Fonts\\msyhl.ttc")
def mat_test():
x_1 = range(2, 14)
x_2 = range(22, 34)
y_1 = [3, 5, 1, 1, 2, 5, 1, 2, 4, 3, 3, 1]
y_2 = [1, 1, 2, 2, 6, 7, 9, 6, 7, 7, 5, 1]
fig = plt.figure(figsize=(20, 8), dpi=80)
plt.scatter(x_1, y_1, label='3月份')
plt.scatter(x_2, y_2, label='10月份')
_x = list(x_1) + list(x_2)
_xtick_labels = ['3月{}日'.format(i) for i in x_1]
_xtick_labels += ['10月{}日'.format(i) for i in x_2]
plt.xticks(_x, _xtick_labels, fontproperties=my_font, rotation=45)
plt.xlabel('时间', fontproperties=my_font)
plt.ylabel('温度', fontproperties=my_font)
plt.title('标题', fontproperties=my_font)
plt.legend(prop=my_font)
plt.savefig('./show.png')
if __name__ == '__main__':
mat_test()