# - - - - - - - - - - - 
# @author like
# @since 2021-02-23 11:08
# @email 980650920@qq.com
# 十点到十二点的气温变化

from matplotlib import pyplot as plt
from matplotlib import rc
from matplotlib import font_manager

import random

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)

# 中文字体
chFont = font_manager.FontProperties(family="SimHei")  # SimHei
# chFont = font_manager.FontProperties(fname="C:/Windows/Fonts/SIMHEI.TTF")

# 刻度相关设置
step = 10
xLabels = ["10点,{}分".format(i) for i in range(60)]
xLabels += ["11点,{}分".format(i) for i in range(60)]
plt.xticks(list(x)[::step], xLabels[::step], rotation=25, fontProperties=chFont)

# 添加描述信息
plt.xlabel("时间", fontProperties=chFont)
plt.ylabel("温度 单位(℃)", fontProperties=chFont)
plt.title("10点到12点每分钟的气温变化", fontProperties=chFont)

plt.show()

[((290, 325), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(20, 8)', 'dpi': '(80)'}), '(figsize=(20, 8), dpi=80)\n', (300, 325), True, 'from matplotlib import pyplot as plt\n'), ((327, 341), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y'], {}), '(x, y)\n', (335, 341), True, 'from matplotlib import pyplot as plt\n'), ((359, 403), 'matplotlib.font_manager.FontProperties', 'font_manager.FontProperties', ([], {'family': '"""SimHei"""'}), "(family='SimHei')\n", (386, 403), False, 'from matplotlib import font_manager\n'), ((704, 743), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""时间"""'], {'fontProperties': 'chFont'}), "('时间', fontProperties=chFont)\n", (714, 743), True, 'from matplotlib import pyplot as plt\n'), ((744, 789), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""温度 单位(℃)"""'], {'fontProperties': 'chFont'}), "('温度 单位(℃)', fontProperties=chFont)\n", (754, 789), True, 'from matplotlib import pyplot as plt\n'), ((790, 841), 'matplotlib.pyplot.title', 'plt.title', (['"""10点到12点每分钟的气温变化"""'], {'fontProperties': 'chFont'}), "('10点到12点每分钟的气温变化', fontProperties=chFont)\n", (799, 841), True, 'from matplotlib import pyplot as plt\n'), ((843, 853), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (851, 853), True, 'from matplotlib import pyplot as plt\n'), ((245, 267), 'random.randint', 'random.randint', (['(20)', '(35)'], {}), '(20, 35)\n', (259, 267), False, 'import random\n')]