猫史档案馆


【Python作品分享】24-突然袭击-1【作业帖】

用户:Kimi_hjhKimi_hjh查看:0 回复:1 评论:0 创建时间:2022-06-11T15:40:04


【作品展示】

center_image

 

【作品介绍】

 

【作品源代码】

from pyecharts import Line
import json
import webbrowser
import os

with open("weather.json", "r") as f:
    data = json.load(f)

# print(data)

mean_temp = data["mean_temp"]
high_temp = data["high_temp"]
low_temp = data["low_temp"]

# print(mean_temp)


xaxis = ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
line = Line("一周温度变化")
line.add("最高气温", xaxis, high_temp)
line.add("最低气温", xaxis, low_temp)
line.add("平均气温", xaxis, mean_temp, yaxis_formatter="°C")
line.render()

webbrowser.open("file://"+os.path.realpath("render.html"))

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
重庆的渝渝重庆的渝渝

真腻害

点赞0


评论