用户:
悠闲的导弹鲨29查看:0 回复:0 评论:0 创建时间:2019-08-28T17:42:29
【作品展示】

【作品介绍】
import jsonfrom pyecharts import Line
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)
x_axis = ['周一','周二','周三','周四','周五','周六','周日']
line = Line("一周温度变化")
line.add("最高气温",x_axis,high_temp)
line.add("最低气温",x_axis,low_temp)
line.add("平均气温",x_axis,mean_temp,yaxis_formatter="°C")
line.render()
webbrowser
【作品源代码】
import json
from pyecharts import Line
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)
x_axis = ['周一','周二','周三','周四','周五','周六','周日']
line = Line("一周温度变化")
line.add("最高气温",x_axis,high_temp)
line.add("最低气温",x_axis,low_temp)
line.add("平均气温",x_axis,mean_temp,yaxis_formatter="°C")
line.render()
webbrowser.open("file://"+os.path.realpath("render.html"))
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn