-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
geom_stratum_text convenience layer? #137
Comments
Hi @EvaMaeRey ! This is something i would have resisted a few years ago, but i'm becoming more comfortable with the convenience of composite geoms nowadays. I wonder if the following would make more sense: No additional stat_stratum(text = TRUE) Does that sound good? Or do you think a new |
I think I'd favor geom_stratum_text(). Two packages that come to mind are ggcirclepack (geom_circlepack and geom_circlepack_test) and ggstats's diverging bar charts (geom_likert and geom_likert_text) for example. I like less of the action to happen in arguments and instead composition via + operator.
My current thinking is:
Then you can write, which, I think, is quite user friendly. ggplot(data) +
aes(...) +
...
...
geom_stratum() +
geom_stratum_text() (And you could even have an alias of the alias geom_stratum_rect() which spells out the stat and geom, but I feel kind of on the fence about it) More folks' perspectives are here: teunbrand/ggplot-extension-club#36 and I think this layer_* idea is especially worth noting, teunbrand/ggplot-extension-club#36 (reply in thread), but I think the convention is to use geom_* to mean layer and layer_* would really be going your own way and potentially confuse users. I push back in the thread! I hope you buy it! 😅 You should definitely weigh in if you've got some thoughts on this, which it sounds like you might! (i.e. fleshing out 'I would have resisted a few years ago...') I think for circlepacking and stratum there might be a greater cause for labels to be more automatic (text = TRUE) where two layers are drawn as default , as it's kind of a legend for the geoms that you get for free when mapping to something like x or y (its pretty hard to interpret stratum and packed circles w/o labels whereas likert plots might be ok w/o - likert labels just give you greater precision about areas). But feels like having rect/cirlce and label layer in one function call feels tricky to me. I got here from your JSM who-are-extenders discussion, btw. :-) |
Just wondering about a convenience layer geom_stratum_text() instead of recommended:
geom_text(stat = "stratum", aes(label = after_stat(stratum)))
Then default_aes for StatStratum would be aes(label = after_stat(stratum)) and geom = GeomText
The text was updated successfully, but these errors were encountered: