.. _jspyechartsrst: ========= pyecharts ========= .. only:: html **Links:** :download:`notebook `, :downloadlink:`html `, :download:`PDF `, :download:`python `, :downloadlink:`slides `, :githublink:`GitHub|_doc/notebooks/2016/pydata/js_pyecharts.ipynb|*` `pyecharts `__ a wrapper for a new library `echarts `__ made by `Baidu `__. `documentation `__ `source `__ `installation `__ `tutorial `__ `gallery `__ .. code:: ipython3 from jyquickhelper import add_notebook_menu add_notebook_menu() .. contents:: :local: .. code:: ipython3 from pyecharts import __version__ __version__ .. parsed-literal:: '1.0.0' example ------- .. code:: ipython3 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() .. raw:: html
After you install `pyecharts-snapshot `__ and `phantom-js `__ (not needed anymore apparently). .. code:: ipython3 bar.render(path="echart_render.html") .. parsed-literal:: 'C:\\xavierdupre\\__home_\\GitHub\\jupytalk\\_doc\\notebooks\\2016\\pydata\\echart_render.html' .. code:: ipython3 from pyecharts_snapshot.main import make_a_snapshot await make_a_snapshot("echart_render.html", "echart_render.png") .. parsed-literal:: Generating file ... .. parsed-literal:: [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:\Users\xavie\AppData\Local\pyppeteer\pyppeteer\local-chromium\575458 .. parsed-literal:: File saved in C:\xavierdupre\__home_\GitHub\jupytalk\_doc\notebooks\2016\pydata\echart_render.png .. code:: ipython3 from IPython.display import Image Image("echart_render.png", width='600') .. image:: js_pyecharts_9_0.png :width: 600px