from matplotlib import pyplot as plt
from matplotlib import font_manager
import random
# 第一种设置字体,遍历系统中的字体
font_list = sorted([f.name for f in font_manager.fontManager.ttflist])
for i in font_list:
print(i)
# 设置字体显示,得到系统的字体的名称可以直接设置
plt.rcParams['font.family'] = ['Microsoft YaHei']
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)]
# 设置x轴刻度 步长间隔为3,_xtick_labels是用这个值来代替刻度数字,rotation为旋转角度,fontproperties为设置字体
plt.xticks(list(x)[::3], _xtick_labels[::3], rotation=45)
# 设置x,y轴描述信息,以及图像的标题
plt.xlabel("时间")
plt.ylabel("温度")
plt.title("温度时间变化折线图")
# 第二种设
from matplotlib import pyplot as pltfrom matplotlib import font_managerimport random# 第一种设置字体,遍历系统中的字体font_list = sorted([f.name for f in font_manager.fontManager.ttflist])for i in font...