pyecharts

Links: notebook, html, python, slides, GitHub

pyecharts a wrapper for a new library echarts made by Baidu.

documentation source installation tutorial gallery

from jyquickhelper import add_notebook_menu
add_notebook_menu()
from pyecharts import __version__
__version__
'1.0.0'

example

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

attr = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
v1 = [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
v2 = [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
bar = Bar().set_global_opts(title_opts=opts.TitleOpts(title="Bar charts",
                                                      subtitle="precipitation and evaporation one year"))
bar.add_xaxis(attr)
ext = opts.MarkLineOpts(data=[opts.MarkLineItem(type_="average")])
bar.add_yaxis("precipitation", v1, markline_opts=ext)
bar.add_yaxis("evaporation", v2, markline_opts=ext)
bar.render_notebook()

After you install pyecharts-snapshot and phantom-js (not needed anymore apparently).

bar.render(path="echart_render.html")
'C:\xavierdupre\__home_\GitHub\jupytalk\_doc\notebooks\2016\pydata\echart_render.html'
from pyecharts_snapshot.main import make_a_snapshot
await make_a_snapshot("echart_render.html", "echart_render.png")
Generating file ...
[W:pyppeteer.chromium_downloader] start chromium download.
Download may take a few minutes.
100%|███████████████████████████████████████████████████████████████| 133194757/133194757 [01:30<00:00, 1473419.97it/s]
[W:pyppeteer.chromium_downloader]
chromium download done.
[W:pyppeteer.chromium_downloader] chromium extracted to: C:UsersxavieAppDataLocalpyppeteerpyppeteerlocal-chromium575458
File saved in C:xavierdupre__home_GitHubjupytalk_docnotebooks2016pydataechart_render.png
from IPython.display import Image
Image("echart_render.png", width='600')
../_images/js_pyecharts_9_0.png