Comparing the best Python Data-Viz Libraries

Date: 30 April 2025

7 min Read

Python

Javascript

Data-Viz

Plotly, Altair and an Unknown winner...

In this article, we will compare the best open-source and interactive data visualization libraries for Python. For this comparison and let's call it an experiment, we will create a chart with medium difficulty using three different libraries.
The chart we chose is a Stacked Area chart, with a datetime brush slider, totals, and an interactive legend.
So let's begin.

Plotly

Plotly is a powerful library used for creating interactive, web-based visualizations. It allows users to create a wide variety of plots, with interactive features, making it a popular tool for data analysis. It integrates well with Python libraries like Pandas and NumPy, and it can be used in Jupyter notebooks.

We used Plotly Express (a high-level Python library) to create the base chart and updated it to our specifications.
The chart was easily created, but out of the box, it had these limitations:

  • The Y-axis does not auto-scale when the brush slider changes, making it hard to see patterns across the timeline.
  • There is no built-in function to calculate the totals or respond to changes in selected legends.
  • When interacting with the legend, changing the selection causes the fill color to disappear (a bug).

Fixes:

  • Using JavaScript (or a widget in Jupyter Notebooks), the sum of totals can be implemented.
  • The Y-axis auto-scaling can be fixed using JavaScript, but the brush is adjusted to the layout of the main chart (Keeping the layout zoom static, makes the brush slider difficult to scroll).

The final chart is shown below, which is useful and interactive

Altair-Vega

Vega-Altair is a Python library for creating declarative visualizations, built on top of the Vega visualization grammar. It allows users to create complex and interactive plots in a declarative manner. It is particularly well-suited for statistical graphics and integrates seamlessly with libraries like Pandas, making it a popular choice for data exploration and analysis in Python.

We used Altair to create the base of the chart. Compared with Plotly, this library required more lines of code for the functional interaction than for the aesthetics.
Anyway, out of the box we found the following limitations:

  • When selecting multiple fields (toggling) with the legend, clicking in the chart or brush clears the last selection.
  • The brush does not work correctly on mobile devices, and the tooltip sticks on the screen if the chart is not touched.
  • Vega still doesn't offer a way to autosize faceted charts.

Fixes:

  • Compiling the chart to Vega solved the issue when toggling.

The final chart is shown below, which is useful and interactive

PyEcharts

ECharts is an open-source JavaScript library for creating interactive, highly customizable charts and visualizations. It supports a wide range of chart types with advanced features. ECharts is designed for both performance and flexibility, making it suitable for handling large datasets while maintaining smooth interactions. It's commonly used in web applications for data visualization. The library is also extensible, allowing developers to create tailored visualizations based on specific needs.
Pyecharts is a Python library that provides a simple interface to create visualizations using ECharts that can be used on the web and in Jupyter Notebooks.

PyEcharts surprisingly was the library that required the least amount of code. The only limitation we found was that there is no native way to add responsive totals to legend changes.

Fixes:

  • Using JavaScript, the totals were added with no further issues.

Conclusion

After this comparison, we found:

Plotly

  • Plotly out of the box required the least amount of code but didn't offer a complete interactive and 'aesthetic' chart.
  • Dealing with events in Plotly required doing some 'tricks', and there was no straightforward solution.
  • The chart still presents some bugs, described above.
  • Works great on mobile devices.

Altair

  • Altair out of the box presented a functional chart, with a bug that was fixed by patching it in Vega.
  • The code required more lines of code but focused primarily on creating the functions of the chart.
  • It's not the best option for mobile apps.

Pyecharts

  • Out of the box, the chart was functional and interactive with the only exception that there was no native way to show totals.
  • Managing events is straightforward, making customization pretty intuitive and easy.
  • Works perfectly on mobile devices

We were surprised by Echarts and PyEcharts because it was the only library that could create a perfectly functional chart with no bugs, using the least amount of code, and intuitive event management.
Additionally, Echarts offers a vast number of different chart types, and its framework structure is intuitive with clear documentation.


Although this library is not well-known in the Python ecosystem, we suggest that anyone interested in data visualization take a look at it.
Since this is a JavaScript-based data visualization library, we also recommend learning the basics of JavaScript for anyone interested in this field, as it is the core of frontend development and, therefore, for interactive charts.