艺赛旗 RPA10.0全新首发免费下载 点击下载
www.i-search.com.cn/index.html?from=line1
1 需求:画出某城市 11 点到 12 点 1 小时内每分钟的温度变化折线图,温度范围在 15 度 ~18 度
import random
import matplotlib.pyplot as plt
设置折线图的大小、清晰度
plt.figure(figsize=(12, 6), dpi=80)
x轴时刻(11~12点)
x = range(60)
y轴温度(15~18度)
y = [random.uniform(15, 18) for i in range(60)]
画折线图
plt.plot(x, y, label=“北京”)
构造中文列表的字符串
x轴(11点**分)
x_ticks = [“11点{}分”.format(i) for i in x]
y轴(0~40)
y_ticks = range(40)
修改x,y坐标的刻度
plt.xticks(x[::5], x_ticks[::5])
plt.yticks(y_ticks[::5])
增加标题、x轴、y轴描述信息
plt.title(“北京市11点到12点1小时内每