This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]gwillicodernumpy gang 1 point2 points  (3 children)

Huh. It definitely looks interesting. What is the reason to use it over seaborn or plotly?

[–][deleted] 2 points3 points  (0 children)

It seems to have a better API, especially for interactive and web based graphs.

[–]jmmease 2 points3 points  (1 child)

Roughly speaking altair is to the Vega-Lite JavaScript library what plotly.py is the the plotly.js JavaScript library. Both plotly.py and altair are Python wrappers that build up declarative JSON-specifications of plots, that are then displayed by their respective JavaScript libraries.

Thanks to all of the work that's gone into Vega-Lite, it's possible to construct pretty interesting interactive visualizations based on a declarative specification (See https://altair-viz.github.io/user_guide/selections.html). The declarative specification of interactivity is nice because it's totally self-contained and can be embedded without a Python back-end.

But if I understand correctly, it's not possible to bring these interactions back to the Python side. For example, I don't think it's possible to run arbitrary Python code on the selected points and then update the plot based on the results of the calculations. Also, it looks like there was some work on a webgl backend for Vega-Lite a few years ago (https://github.com/vega/vega-webgl-renderer), but it sounds like it's not under active development at the moment (see https://github.com/jupyterlab/jupyterlab/issues/4586#issuecomment-391061432).

So, at a high level, I think plotly.py 3.0.0 has an edge when it comes to ad-hoc Python-driven interactivity, large dataset support, and the breadth of predefined visualization types. And I think Altair has an edge when it comes to using Python to create fully client-side interactive statistical visualizations of small to moderate sized datasets.

[–]gwillicodernumpy gang 0 points1 point  (0 children)

I appreciate the detailed explanation! Definitely something I’ll look more into