Live data from Hacker News

Altair – A declarative statistical visualization library for Python

github.com

31–40 of 45 posts

Re: Altair – A declarative statistical visualization library for Python

#31

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?

If you are not familiar with them, the comparison is useful to help you decide which one to choose?

Re: Altair – A declarative statistical visualization library for Python

#32
post #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

Yeah, it is often a mystery just what options I have available to use in matplotlib, and it can be tricky to find which one is the one I actually want!

Re: Altair – A declarative statistical visualization library for Python

#33
I gave altair a try but I found the data format requirements a pain that got in the way of the nice plotting API. For example, I wanted to plot n lines, stored in a (timestamps, n) shaped matrix. First I had to convert this into a format: (index, line_name, value) where index is the timestamps index in the original matrix, line_name is a unique name given to each line/column, and finally the value. There is a pandas method that helps with this conversion, but it just added one extra confusing step to what I was hoping to be a quick and intuitive plotting tool.

Their write up on the data format is here: https://altair-viz.github.io/user_guide/data.html#long-form-...

Re: Altair – A declarative statistical visualization library for Python

#34

I've always hated matplotlib, even though it gets the job done. The graphs are ugly by default, and the API would be unusable if it weren't for StackOverflow. Maybe I just need to sit down and learn it really well. Anyway, this seems cool.

While writing my thesis I found matplotlib to be quite beautiful with adjustments only on the text (use LaTeX rendering to fit in with the thesis doc itself) and colour schemes; that is literally three lines of code at most. It's not ugly by default either, it produces very crisp graphics easily.

Re: Altair – A declarative statistical visualization library for Python

#36
post #29

I've always hated matplotlib, even though it gets the job done. The graphs are ugly by default, and the API would be unusable if it weren't for StackOverflow. Maybe I just need to sit down and learn it really well. Anyway, this seems cool.

> even though it gets the job done How is this an addendum, rather than the main point? I will always take a flexible library that allows me to "get the job done" over a declarative framework that will do something similar to—but not exactly—what I need.

I've come to the same conclusion.

GGplot2 is _very_ nice to use and an incredible library...as long as you want to do something the package author approves of. Want to change some behavior about how bins are generated because the default behavior lies? Too bad.

Matplotlib is ugly, but it doesn't make decisions for you, and once you understand it, you can do anything with it.

Re: Altair – A declarative statistical visualization library for Python

#37
post #33

I gave altair a try but I found the data format requirements a pain that got in the way of the nice plotting API. For example, I wanted to plot n lines, stored in a (timestamps, n) shaped matrix. First I had to convert this into a format: (index, line_name, value) where index is the timestamps index in the original matrix, line_name is a unique name given to each line/column, and finally the value. There is a pandas…

Wouldn't any plotting library suffer from this challenge anyways?

One would first make a relevant data transform and then send it to whatever plotting library. I suspect anything further would limit the flexibility of the plotting library. To make sure I have minimal pain with data transforms, I first store/transform data exactly like I would in a real transactional database. Beyond that it just becomes a matter a joins and filters/projections.

Re: Altair – A declarative statistical visualization library for Python

#38
post #29

Earlier quoted context omitted.

> even though it gets the job done How is this an addendum, rather than the main point? I will always take a flexible library that allows me to "get the job done" over a declarative framework that will do something similar to—but not exactly—what I need.

I've come to the same conclusion. GGplot2 is _very_ nice to use and an incredible library...as long as you want to do something the package author approves of. Want to change some behavior about how bins are generated because the default behavior lies? Too bad. Matplotlib is ugly, but it doesn't make decisions for you, and once you understand it, you can do anything with it.

[deleted]

Re: Altair – A declarative statistical visualization library for Python

#39
post #29

I've always hated matplotlib, even though it gets the job done. The graphs are ugly by default, and the API would be unusable if it weren't for StackOverflow. Maybe I just need to sit down and learn it really well. Anyway, this seems cool.

> even though it gets the job done How is this an addendum, rather than the main point? I will always take a flexible library that allows me to "get the job done" over a declarative framework that will do something similar to—but not exactly—what I need.

Getting the job done is the main point, of course, but I think a visualisation library should also handle common cases gracefully and have defaults that don't make me want to gouge my eyes out.

Every time I use matplotlib, I have to look up how to remove the border on my graph, make things slightly transparent, etc. The default colour palette isn't colourblind friendly, so the other day I spent half an hour trying to set up a more accessible one. I had to create / fetch 3 objects, their names being something like ScalarMap, Normalize and cmap. Why do I need to understand the relationship between these 3 objects when all I want to do is switch from one palette to another?

Meanwhile, it's so flexible as to be annoying for a non-expert. I often encounter matplotlib answers on StackOverflow about things that I would expect to "just work", but that actually require 20 lines of code to solve, written by someone who appears to be deeply familiar with the internals of the library.

Note: I'm not saying that a declarative approach solves these things.

Re: Altair – A declarative statistical visualization library for Python

#40

I've always hated matplotlib, even though it gets the job done. The graphs are ugly by default, and the API would be unusable if it weren't for StackOverflow. Maybe I just need to sit down and learn it really well. Anyway, this seems cool.

While writing my thesis I found matplotlib to be quite beautiful with adjustments only on the text (use LaTeX rendering to fit in with the thesis doc itself) and colour schemes; that is literally three lines of code at most. It's not ugly by default either, it produces very crisp graphics easily.

Beauty is in the eye of the beholder, I guess. I wouldn't put matplotlib graphs in a paper without tweaking the style, and it gets frustrating when you have to do this for every single plotting script you write. And the defaults certainly aren't colourblind-friendly.
Post reply on HN