# pyecharts **Repository Path**: mirrors/pyecharts ## Basic Information - **Project Name**: pyecharts - **Description**: pyecharts 是一个用于生成 Echarts 图表的类库 - **Primary Language**: Python - **License**: MIT - **Default Branch**: master - **Homepage**: https://www.oschina.net/p/pyecharts - **GVP Project**: No ## Statistics - **Stars**: 157 - **Forks**: 7 - **Created**: 2017-07-29 - **Last Updated**: 2024-05-27 ## Categories & Tags **Categories**: charting-components **Tags**: None ## README
Python ❤️ ECharts = pyecharts
[English README](README.en.md) ## 📣 简介 [Apache ECharts](https://github.com/apache/echarts) 是一个由百度开源的数据可视化,凭借着良好的交互性,精巧的图表设计,得到了众多开发者的认可。而 Python 是一门富有表达力的语言,很适合用于数据处理。当数据分析遇上数据可视化时,[pyecharts](https://github.com/pyecharts/pyecharts) 诞生了。 ## ✨ 特性 * 简洁的 API 设计,使用如丝滑般流畅,支持链式调用 * 囊括了 30+ 种常见图表,应有尽有 * 支持主流 Notebook 环境,Jupyter Notebook、JupyterLab 和 [marimo](https://github.com/marimo-team/marimo) * 可轻松集成至 Flask,Sanic,Django 等主流 Web 框架 * 高度灵活的配置项,可轻松搭配出精美的图表 * 详细的文档和示例,帮助开发者更快的上手项目 * 多达 400+ 地图文件,并且支持原生百度地图,为地理数据可视化提供强有力的支持 ## ⏳ 版本 v0.5.x 和 V1 间不兼容,V1 是一个全新的版本,详见 [ISSUE#892](https://github.com/pyecharts/pyecharts/issues/892),[ISSUE#1033](https://github.com/pyecharts/pyecharts/issues/1033)。 ### V0.5.x > 支持 Python 2.7,3.4+ 经开发团队决定,0.5.x 版本将不再进行维护,0.5.x 版本代码位于 *05x* 分支,文档位于 [05x-docs.pyecharts.org](http://05x-docs.pyecharts.org)。 ### V1 > 仅支持 Python 3.7+ 新版本系列将从 v1.0.0 开始,文档位于 [pyecharts.org](https://pyecharts.org);示例位于 [gallery.pyecharts.org](https://gallery.pyecharts.org) ### V2 > 仅支持 Python 3.7+ 新版本基于 Echarts 5.4.1+ 进行渲染, 文档和示例位置与 V1 相同 ## 🔰 安装 **pip 安装** ```shell # 安装 v1 以上版本 $ pip install pyecharts -U # 如果需要安装 0.5.11 版本的开发者,可以使用 # pip install pyecharts==0.5.11 ``` **源码安装** ```shell # 安装 v1 以上版本 $ git clone https://github.com/pyecharts/pyecharts.git # 如果需要安装 0.5.11 版本,请使用 git clone https://github.com/pyecharts/pyecharts.git -b v05x $ cd pyecharts $ pip install -r requirements.txt $ python setup.py install ``` ## 📝 使用 ### 本地环境 #### 生成 HTML ```python from pyecharts.charts import Bar from pyecharts import options as opts # V1 版本开始支持链式调用 bar = ( Bar() .add_xaxis(["衬衫", "毛衣", "领带", "裤子", "风衣", "高跟鞋", "袜子"]) .add_yaxis("商家A", [114, 55, 27, 101, 125, 27, 105]) .add_yaxis("商家B", [57, 134, 137, 129, 145, 60, 49]) .set_global_opts(title_opts=opts.TitleOpts(title="某商场销售情况")) ) bar.render() # 不习惯链式调用的开发者依旧可以单独调用方法 bar = Bar() bar.add_xaxis(["衬衫", "毛衣", "领带", "裤子", "风衣", "高跟鞋", "袜子"]) bar.add_yaxis("商家A", [114, 55, 27, 101, 125, 27, 105]) bar.add_yaxis("商家B", [57, 134, 137, 129, 145, 60, 49]) bar.set_global_opts(title_opts=opts.TitleOpts(title="某商场销售情况")) bar.render() ```