In this article we compare three of the best open-source, interactive data visualisation libraries for Python. For this experiment we build a medium-difficulty chart with each of them.
The chart we chose is a stacked area chart with a datetime brush slider, totals and an interactive legend. Let's begin.
Plotly
Plotly is a powerful library for creating interactive, web-based visualisations. It supports a wide variety of plots with interactive features, which has made it a popular choice for data analysis. It works well with Python libraries such as Pandas and NumPy and can be used in Jupyter notebooks.
We used Plotly Express, its high-level Python interface, to create the base chart and then adjusted it to our specification. The chart was easy to build, but out of the box it had a few limitations:
- The Y-axis does not rescale when the brush slider changes, which makes it hard to see patterns across the timeline.
- There is no built-in way to calculate totals or to react to changes in the selected legend items.
- When you interact with the legend, the fill colour disappears (a bug).
Fixes
- Totals can be added with JavaScript (or with a widget in Jupyter notebooks).
- The Y-axis autoscaling can also be fixed with JavaScript, but the brush follows the layout of the main chart, so keeping the zoom static makes the brush slider hard to scroll.
Altair (Vega-Altair)
Vega-Altair is a Python library for declarative visualisation, built on the Vega grammar. It lets you create complex, interactive plots declaratively and is particularly well suited to statistical graphics. It integrates smoothly with Pandas, which makes it a popular choice for data exploration.
We used Altair to build the base chart. Compared with Plotly, it needed more code for the interaction than for the look. We also found these limitations:
- When several items are selected through the legend, clicking the chart or the brush clears the last selection.
- The brush does not work correctly on mobile devices, and the tooltip stays stuck on screen if the chart is not touched.
- Vega still has no way to autosize faceted charts.
Fixes
- Compiling the chart to Vega solved the toggling issue.
PyEcharts
ECharts is an open-source JavaScript library for creating highly customisable, interactive charts. It supports a wide range of chart types and advanced features, and it is designed for both performance and flexibility, so it can handle large datasets while keeping interactions smooth. It is widely used in web applications and is extensible, so developers can build visualisations tailored to their needs.
PyEcharts is a Python library that offers a simple interface to ECharts, for the web and for Jupyter notebooks.
PyEcharts surprised us: it needed the least code of the three. The only limitation was that there is no native way to show totals that respond to legend changes.
Fixes
- Totals were added with a little JavaScript and no further issues.
Conclusion
Plotly
- Needed the least code out of the box, but did not give a fully interactive and polished chart.
- Handling events took some tricks, and there was no straightforward solution.
- The chart still has the bugs described above.
- Works great on mobile devices.
Altair
- Produced a working chart out of the box, with one bug that we fixed by patching it in Vega.
- Needed more code, mostly to define the chart's behaviour.
- It is not the best option for mobile apps.
PyEcharts
- The chart was functional and interactive out of the box. The only gap was the lack of native totals.
- Event handling is straightforward, so customising it is intuitive and easy.
- Works perfectly on mobile devices.
We were surprised by ECharts and PyEcharts. It was the only library that produced a fully functional chart with no bugs, the least code and intuitive event handling. ECharts also offers a huge number of chart types, a clear structure and good documentation.
Although it is not well known in the Python ecosystem, we recommend that anyone interested in data visualisation take a look at it. And since it is a JavaScript-based library, we also recommend learning the basics of JavaScript: it is the core of front-end development and therefore of interactive charts.



