环境: vscode,Python,pyechart
作图后没有任何结果,也没找到HTML文件 这是代码
from pyecharts import options as opts
from pyecharts.charts import TreeMap
from pyecharts.globals import ThemeType
data = [
{"value": 2, "name": "新一线城市"},
{"value": 0,"name": "一线城市"},
{"value": 73,"name": "二线城市"},
{"value": 227,"name": "三线城市"},
{"value": 2,"name": "四线城市"},
{"value": 2,"name": "五线城市"},
]
c = (
TreeMap(init_opts=opts.InitOpts(theme=ThemeType.LIGHT))
.add("比例", data)
.set_global_opts(title_opts=opts.TitleOpts(title="城比"))
.set_series_opts(label_opts=opts.LabelOpts())
)
c.render_notebook()
问题所在 最后一句代码c.render_notebook()
改成c.render()
再次运行后出现了HTML文件 点击看结果 第一个pyecharts矩形数状图完成。
|