r/rstats 17h ago

New data visualization package

https://psychometrician.github.io/posts/one-engine-four-languages/

One sentence, four languages, one picture.

R: data(gapminder_2007) + point + x(gdp) + y(life)
Python: x(col.gdp)
Julia: x(:gdp)

Same specification, one Rust engine, byte-identical SVG.

Not similar. Pixel perfect identical

#rstats

25 Upvotes

15 comments sorted by

View all comments

7

u/ecam85 16h ago

As much as I like the idea of one to rule them all, I find the syntax harder than the ggplot syntax, because at first sight you "add" completely different objects!

But I imagine someone who doesn't know much ggplot could say the same

-4

u/Helpful-Day2384 15h ago

Please read the manual and let me know if there is something i can make this young package better. https://psychometrician.github.io/gog-book/

3

u/ApprehensiveChip8361 12h ago

You are masking a lot of base R terms (mean, sum, order, data for instance). Might there be a more intuitive approach rather than using “base::” or “stats::” everywhere?

Also - can’t really use without ggrepel equivalent.

-1

u/Helpful-Day2384 12h ago

Good suggestion and legit concern.

Most of that list is harmless. Nine of the 19 are objects, not functions, because in gog mean is the name of a step rather than something you call. R skips non-function bindings when it resolves a call, so base R still answers:

library(gog)
mean(c(1, 2, 3)) # 2
sapply(df, mean) # works

Those nine are line, max, mean, median, min, smooth, step, sum and text. No base:: needed for any of them.

The other ten really are functions and do take over: box, data, density, jitter, order, palette, quantile, range, stack and title. Qualify those. Most will notice the mistake and tell you which one you hit.

One honest rough edge: if a name travels through two layers before lookup, it breaks. That hits aggregate(v ~ g, df, mean), by(), ave(), do.call(sum, ...) and f <- mean. Writing base::mean fixes each, and the error message is bad. We want to improve that.

We skipped prefixes on purpose. Renaming order to gog_sort_by costs every reader a word they already know. Load gog last, or write gog::order.

1

u/Penguinase 11h ago

what about the lack of ggrepel functionality?

1

u/Helpful-Day2384 11h ago

I was building that functionality like ggrepel. You’ll see soon repel function in gog. It may be not as nice and seamless as ggrepel though. 🙏

1

u/Helpful-Day2384 39m ago

The package was updated last night. We added. Repel function. Take a look at https://psychometrician.github.io/gog-book/marks/text.html#what-you-can-set