{"id":5393,"library":"pyecharts","title":"Pyecharts","description":"Pyecharts is a powerful and flexible Python library designed to generate interactive ECharts-based visualizations. It provides a Pythonic interface to over 30 chart types, making it easier to create stunning and interactive data visualizations for web pages, Jupyter notebooks, and other Python frameworks. The library is actively maintained, with the current stable version being 2.1.0, released in February 2026, and regular updates incorporating new ECharts features.","status":"active","version":"2.1.0","language":"en","source_language":"en","source_url":"https://github.com/pyecharts/pyecharts","tags":["charts","visualization","ECharts","frontend","interactive"],"install":[{"cmd":"pip install pyecharts","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Required for exporting charts as images (PNG, JPEG, PDF, SVG, etc.). It relies on browser automation tools like pyppeteer or selenium.","package":"pyecharts-snapshot","optional":true},{"reason":"Optional package for world map data. Other map packages (e.g., `echarts-china-provinces-pypkg`) are needed for specific regional maps.","package":"echarts-countries-pypkg","optional":true}],"imports":[{"symbol":"Bar","correct":"from pyecharts.charts import Bar"},{"symbol":"options","correct":"from pyecharts import options as opts"},{"symbol":"ThemeType","correct":"from pyecharts.globals import ThemeType"}],"quickstart":{"code":"from pyecharts.charts import Bar\nfrom pyecharts import options as opts\n\n# Create a Bar chart instance\nbar = (\n    Bar()\n    .add_xaxis([\"Shirt\", \"Sweater\", \"Tie\", \"Pants\", \"T-shirt\", \"Jacket\"])\n    .add_yaxis(\"Seller A\", [10, 20, 30, 40, 50, 60])\n    .add_yaxis(\"Seller B\", [15, 25, 35, 45, 55, 65])\n    .set_global_opts(\n        title_opts=opts.TitleOpts(title=\"ECharts Bar - Basic\"),\n        legend_opts=opts.LegendOpts(pos_left='center')\n    )\n)\n\n# Render the chart to an HTML file\nbar.render(\"my_first_chart.html\")\nprint(\"Chart saved to my_first_chart.html\")\n","lang":"python","description":"This quickstart code creates a simple interactive bar chart using Pyecharts, adds two data series, and saves the chart as an HTML file named 'my_first_chart.html' in the current directory. This HTML file can then be opened in any web browser."},"warnings":[{"fix":"Review chart configurations and ECharts 6.x upgrade guide for changes in default themes, component positioning, and API updates. For styling, explicit `theme_opts` and `pos_top`, `pos_left` for legends can help restore previous layouts. The original ECharts documentation provides detailed migration steps from v5 to v6.","message":"Pyecharts v2.1.0 introduces compatibility with ECharts 6.x. This update may lead to breaking changes compared to ECharts 5.x, including modifications to the default theme, legend positions (now defaulting to the bottom), and subtle shifts in Cartesian axis labels if they previously overflowed or overlapped. Users migrating from versions <=2.0.9 (which supported ECharts 5.x) should review their chart configurations.","severity":"breaking","affected_versions":">=2.1.0"},{"fix":"Ensure your Python environment is version 3.7 or higher. Upgrade Python if necessary, or use a virtual environment with a compatible Python version.","message":"Pyecharts V1 and V2 (including current v2.x) require Python 3.7 or newer. Earlier versions (v0.5.x) supported Python 2.7 and 3.4+. Attempting to use pyecharts v1+ in older Python environments will result in import errors or unexpected behavior.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Install the relevant map data package using pip, for example, `pip install echarts-countries-pypkg` for world maps or `echarts-china-provinces-pypkg` for Chinese provincial data.","message":"Map chart data (e.g., world maps, Chinese provinces) is not bundled with the `pyecharts` core package since v0.3.2. Users must install separate `echarts-*-pypkg` extension packages for the specific map data they need (e.g., `pip install echarts-countries-pypkg`).","severity":"gotcha","affected_versions":">=0.3.2"},{"fix":"Install `pyecharts-snapshot` (`pip install pyecharts-snapshot`) and its chosen backend (e.g., `pip install snapshot-pyppeteer` and ensure Node.js is installed on your system).","message":"Exporting charts as static images (PNG, JPEG, PDF, SVG) requires the `pyecharts-snapshot` library along with a rendering backend like `pyppeteer` (which requires Node.js) or `selenium` (which requires a WebDriver). Without these, `chart.render()` will only output HTML, and image export methods will fail.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Convert `numpy` arrays or `pandas` Series/DataFrames to standard Python lists before passing them to `pyecharts` chart methods (e.g., `add_xaxis(data.tolist())`, `add_yaxis(name, values.tolist())`).","message":"When working with `numpy` arrays or `pandas` Series/DataFrames, `pyecharts` expects data to be in standard Python list formats. While v2.0.5 added better error messages, passing non-native data structures directly can still lead to unexpected behavior or errors if not explicitly converted (e.g., using `.tolist()`).","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use `chart.render_notebook()` for Jupyter environments. When generating standalone HTML files, be aware of the `is_embed_js` option on `Page` and `InitOpts` for controlling JavaScript embedding for offline access or smaller file sizes.","message":"By default, `chart.render('filename.html')` saves the chart as an HTML file with embedded JavaScript dependencies. For displaying charts directly within Jupyter notebooks or similar environments, `chart.render_notebook()` is often preferred. For `Page` objects, the `is_embed_js=True` parameter can be used to explicitly embed all JavaScript resources into a single HTML file for offline use.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}