Live data from Hacker News

Altair – A declarative statistical visualization library for Python

github.com

11–20 of 45 posts

Re: Altair – A declarative statistical visualization library for Python

#11
Altair is amazing. I've been using matplotlib going on 12 years now -- Altair didn't feel more productive at first (more typing), but the longer you work with it, the more you realize how the API is a cohesive system. This leads to a more iterative workflow and eventually to better visualizations.

Re: Altair – A declarative statistical visualization library for Python

#12
post #9

Earlier quoted context omitted.

I've seen this done by making a fake legend out of a bar chart. As far as I know, there's no way to make an interactive legend in Altair. Personally I would look into plotly / dash for something with interactivity.

Altair does have interactive legends actually. But dash is great for more complicated interactions and layouts. Panel, streamlit, and voila are also all potentially useful. https://altair-viz.github.io/gallery/interactive_legend.html https://altair-viz.github.io/user_guide/interactions.html#se...

I stand corrected, I may have to revisit Altair.

Some of those other options look pretty compelling too I think it's definitely time for something to replace Matplotlib as the go-to for python plotting.

Re: Altair – A declarative statistical visualization library for Python

#13
I especially liked the example of the interactive cross-filter: https://altair-viz.github.io/gallery/interactive_layered_cro...

However I didn't get around to learning the principles to use it regularly. And I fear if you have a certain chart in your head with some special stuff you end up tinkering around eventually get a lot of code.

Re: Altair – A declarative statistical visualization library for Python

#14
Hope I get to use this in a project one day!

Declarative systems always seem to feel good (SQL and React come to mind)

Vega-lite is the underlying standard (A Grammar of Interactive Graphics ): https://vega.github.io/vega-lite/

I used altair in a hackathon interview and got the job: https://github.com/DustinAlandzes/drchrono-hackathon/blob/ma...

sadly not hosted

Re: Altair – A declarative statistical visualization library for Python

#17

I am definitely going to give it a try but I wish statistical/scientific plotting libraries' documentation would include example comparisons with matplotlib and ggplot2. I usually just want to know how much easier/prettier will library X be to use compared to those two.

> I usually just want to know how much easier/prettier will library X be to use compared to those two.

Don't the examples in the README provide a good enough intro?

If you are familiar with matplotlib and ggplot, you'd have a good idea how to reproduce those examples in those frameworks. If you are not familiar with them, then what good is the comparison?

Re: Altair – A declarative statistical visualization library for Python

#18
We used altair to develop an analytics dashboard as part of our single page application (SPA). We developed a web component encapsulating vega-lite JS library and used that component to assemble the dashboard which is part of the application. Altair based backend can use custom renderer to generate target response for analytics API requests. [1]

Most of the commercial and open source solutions including Tableau, Apache Superset, Metabase were very complicated to provide a seamless integrated dashboard with our Single Page Application using the same authenticaton and authorization layer. Most of these solutions recommend using iFrame. With altair we could directly generate the target vega-lite json for our web component and it work seamless.

Also for some static reports we could generate output in other formats from altair directly. Altair being in Python (Apache Superset was a big contender), it was easy enough to integrate into our backend as one of the analytics services provider. Given vega-lite and vega grammar is standardized, we are exploring to build real-time dashboard analytics application for large multi-screen display in a control room kind of an environment.

Before altair our backend was generating data directly consumed by chartjs web component.

[1] https://altair-viz.github.io/user_guide/custom_renderers.htm...

Re: Altair – A declarative statistical visualization library for Python

#19
Python's ploting problem is not imperative vs declarative. The main ugliness is basically "* * kwargs" every where. Every time it force you look at document to just find name of parameter you are looking for. Another common problem is Configs pass as string rather than enum.

Re: Altair – A declarative statistical visualization library for Python

#20
post #19

Python's ploting problem is not imperative vs declarative. The main ugliness is basically "* * kwargs" every where. Every time it force you look at document to just find name of parameter you are looking for. Another common problem is Configs pass as string rather than enum.

are you arguing against keyword arguments in general, or against

  def foo(a, b, **kwargs): 
    """
    Refer to `bar` for the full list of allowed kwargs.
    """
    ...
i don't mind the former, but the latter always feels annoying. iirc matplotlib severely suffers from this
Post reply on HN