4 ms·
I'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 Rus
by williamcotton 3mo ago
I'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 https://williamcotton.github.io/algraf
It pairs well with a related data translation DSL:
https://williamcotton.github.io/pdl https://williamcotton.github.io/pdl
And you can see the two working together here:
https://williamcotton.github.io/datafarm-studio https://williamcotton.github.io/datafarm-studio
There's LSPs for both, LSP clients for VS Code, and even language diagnostics for standalone Monaco editors in the browser.
Of note is that the same language diagnostics are exposed via the WASM as via the LSP interface allowing for the same friendly red squiggles to look and work the same in both your browser with Monaco and your editor with the LSP!
- deleted 3mo ago[deleted]
- tmoertel 3mo agoNifty! What motivated you to create these tools?
- williamcotton 3mo agoI really like to build things that build other things!
- stared 3mo agoA year ago, added R to the pipeline (with multiple complications) just to use ggplot2 - even though Python was the main tech. https://quesma.com/blog/sandboxing-ai-generated-code-why-we-moved-from-webr-to-aws-lambda/ 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 https://github.com/QuesmaOrg/webr-ggplot-playground
- williamcotton 3mo agoA big part of the motivation was that something like this... $ which ggplot ggplot () { if [[ "$1" == "-f" ]] then shift rush run --library tidyverse "$(cat "$1")" - else rush run --library tidyverse "$@" - fi } $ echo "one,two,three\n1,2,3\n4,5,6\n,7,8,9" | ggplot 'ggplot(df, aes(one, two)) + geom_col() + theme_minimal()' | imgcat ...is just very slow. Booting R just to run ggplot2 was not cutting it compared to a custom DSL written in Rust! BTW, that "R on the command line" tool was inspired by: https://datascienceatthecommandline.com https://datascienceatthecommandline.com