Hacker News new | past | comments | ask | show | jobs | submit login

Like many, I was a big fan of ggplot2 from R, so coming into Python, I've always been searching for an equivalent graphical library. I used to be put off by Altair's famous

    MaxRowsError: The number of rows in your dataset is greater than the maximum allowed (5000).
but ever since the Vegafusion companion library came unto the scene, I'm back using Altair.

Overall, it's my preferred Python viz library although I do wish there was a better way for the Python library to better use introspection. After all, rather than

   alt.Chart(df).mark_line.encode(x="abc:Q")
to provide the information that abc is a quantitative variable, I'd much rather the library be able to introspect the df object, column abc to derive the data type and make the inference the column is quantitative.

That said, I'm already used to the extra syntax so still feel confident in using this library daily.

[1] https://vegafusion.io/index.html




Altair actually does introspection when the data is passed as a dataframe (e.g. via pandas or polars). In these cases you can leave out the `:Q` and just write `x='abc'` and Altair will figure out that the encoding type shoudl be quantitative based on the column datatype in the dataframe.

If you are reading the data directly from a URL instead of via a dataframe, the URL is passed on to Vega-Lite and Python never sees the data, so no introspection can be made on the Altair side of things.

(disclaimer: I'm a co-maintainer of Altair)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: