Plotnine
41–50 of 83 posts
Re: Plotnine
#42Re: Plotnine
#43(Disclosure: I'm at Posit, which supports plotnine.)
Re: Plotnine
#44Earlier quoted context omitted.
Because, in the latter case, you have to declare a function argument for /every possible option/ that you want your graphics API to expose, and you need to do this every time you add a new option. On the other hand, declaring the options through composition means that the API for "plot" remains static, and adding/removing options can be done trivially without an API change. Composition (rather than parameters) is als…
And how do you express that as arithmetic? I can get as far as `plot() / 3` but then no idea how to proceed. I don't think overloading arithmetic is a very good way to express this.
Separately you might find this to be smelly design, but then you should remember that this at least has precedence ¯\_(ツ)_/¯
Re: Plotnine
#45matplotlib is what most folks reach for by default, but I'd argue that's habit and popularity talking, not a real fit advantage. For a lot of plotting work, the grammar-of-graphics libraries — Altair, plotnine — may be the better tool for many people (and Agents); they just don't have the muscle memory behind them. (Disclosure: I'm at Posit, which supports plotnine.)
Re: Plotnine
#46Earlier quoted context omitted.
Because, in the latter case, you have to declare a function argument for /every possible option/ that you want your graphics API to expose, and you need to do this every time you add a new option. On the other hand, declaring the options through composition means that the API for "plot" remains static, and adding/removing options can be done trivially without an API change. Composition (rather than parameters) is als…
kwargs exists, and is rather more pythonic. Just pass the kwargs dict to a standard formatting function, et voila.
Re: Plotnine
#47matplotlib is what most folks reach for by default, but I'd argue that's habit and popularity talking, not a real fit advantage. For a lot of plotting work, the grammar-of-graphics libraries — Altair, plotnine — may be the better tool for many people (and Agents); they just don't have the muscle memory behind them. (Disclosure: I'm at Posit, which supports plotnine.)
PS. It took someone in the comments writing "import plotnine as p9" for me to understand it isn't plotLine.
Re: Plotnine
#48I've always liked the ggplot2 and the Grammar of Graphics approach to plotting so much so that I wrote my own DSL based on it - it is standalone, written in Rust, has WASM bindings (as you can see on the website) and more: https://williamcotton.github.io/algraf It pairs well with a related data translation DSL: https://williamcotton.github.io/pdl And you can see the two working together here: https://williamcotton.gi…
https://quesma.com/blog/sandboxing-ai-generated-code-why-we-...
Good, that ggplot2 can run inside in WASM, vide https://github.com/QuesmaOrg/webr-ggplot-playground
Re: Plotnine
#49matplotlib is what most folks reach for by default, but I'd argue that's habit and popularity talking, not a real fit advantage. For a lot of plotting work, the grammar-of-graphics libraries — Altair, plotnine — may be the better tool for many people (and Agents); they just don't have the muscle memory behind them. (Disclosure: I'm at Posit, which supports plotnine.)
What would you say are the benefits of the grammar-of-graphics approach? I've been working with plotting for more than a decade now and have never heard of it. Right now I'm looking through the gallery and can't really grasp what makes this approach better than the one in matplotlib. PS. It took someone in the comments writing "import plotnine as p9" for me to understand it isn't plotLine.