笔记
import random
from matplotlib import pyplot as plt
from matplotlib.font_manager import FontProperties
font = FontProperties(fname='C:/Windows/Fonts/msyh.ttc')
plt.rcParams['font.family'] = font.get_name()
x = range(0, 120)
y = [random.randint(20, 35) for i in range(120)]
plt.figure(figsize=(20,8),dpi=80)
plt.plot(x, y)
_xtick_labels = ["10点{}分".format(i) for i in range(60)]
_xtick_labels += ["11点{}分".format(i) for i in range(60)]
plt.xticks(list(x)[::3], _xtick_labels[::3], rotation=45)
plt.xlabel('时间', fontproperties=font)
plt.ylabel('温度 单位(℃)', fontproperties=font)
plt.title('10点到12点每分钟的气温变化情况', fontproperties=font)
plt.show()