其他分享
首页 > 其他分享> > pyecharts on zeppelin可视化

pyecharts on zeppelin可视化

作者:互联网

具体步骤:

1、在顶部声明 Notebook 类型,必须在引入 pyecharts.charts 等模块前声明

from pyecharts.globals import CurrentConfig, NotebookType
 CurrentConfig.NOTEBOOK_TYPE = NotebookType.ZEPPELIN

2、Zeppelin 调用 render_notebook 方法即可渲染

%python
from pyecharts.globals import CurrentConfig, NotebookType
CurrentConfig.NOTEBOOK_TYPE = NotebookType.ZEPPELIN

import pyecharts.options as opts
from pyecharts.charts import Bar

bar = (
    Bar()
    .add_xaxis(["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"])
    .add_yaxis("商家A", [5, 20, 36, 10, 75, 90])
    .add_yaxis("商家B", [15, 6, 45, 20, 35, 66])
    .set_global_opts(title_opts=opts.TitleOpts(title="主标题", subtitle="副标题"))
)

bar.render_notebook()

 

标签:CurrentConfig,pyecharts,add,可视化,zeppelin,import,opts,NotebookType
来源: https://www.cnblogs.com/Ao0216/p/15978804.html