ropensci / ozunconf17

Website for 2017 rOpenSci Ozunconf
http://ozunconf17.ropensci.org/
24 stars 6 forks source link

ggplot2 helpers #24

Open jonocarroll opened 6 years ago

jonocarroll commented 6 years ago

This didn't seem to gather any interest in ggplot2 itself so perhaps this is a good unconf project?

The idea is that

theme(axis.text.x = element_text(angle = 90, vjust = 0.5))

is horrible to remember, but if we had

theme_label_x_vertical <- function(angle = 90, align = "left") {
  theme(axis.text.x = element_text(angle = angle, vjust = <switch to determine value>))
}

then we might actually remember what we want (plus autocomplete FTW).

We could make a ggeasy package which contains a heap of extension helpers, aliasing extras as needed. magrittr has a nice set of aliases which I use all the time (refer ?magrittr::extract for everyone who isn't already @smbache).

This would:

adam-gruer commented 6 years ago

My most visited stack overflow answer! also, my brain refuses to interpret ggeasy as anything other than greasy

jonocarroll commented 6 years ago

Mine too. Also drob's and a few other big wigs' I'm told. We can make this better.

I will gladly work on this as greasy.

softloud commented 6 years ago

No matter how many times I try, my brain just does not remember this one. Every damn time I have to look it up. I remember finding a pretty good tool for the x-axis, but I think it was when I wanted to do a coord-flip ggplot I found I couldn't do the same for the y-axis. I'm personally invested in improving this one, count me in.

adam-gruer commented 6 years ago

Me: this chart would look better if the tick labels were rotated My brain: winona

timchurches commented 6 years ago

I like this one. I have

theme(axis.text.x = element_text(angle = 90, vjust = 0.5))

stored in a note on my laptop, but it is a pain to have to find it and paste it into code. My brain also refuses to memorise the horrible syntax.

The extensions probably don't even need a _theme__ prefix?

jonocarroll commented 6 years ago

theme_ isn't a strict requirement, but I'd like a way to distinguish these helpers from standard ggplot2 syntax so that they'll be recognised as such. Even easy_label_x_vertical() would be neat. People won't always write ggeasy::label_x_vertical().

jonocarroll commented 6 years ago

Given that this one's fairly easy to implement, three options would be

The CRAN route would be neat because it's a non-trivial component of package making in and of itself. I do a lot of testing when I submit, so rhub, travis, appveyor, devtools (check(), test(), build_win()), testthat, and covr all come into play.

AliciaSchep commented 6 years ago

@jonocarroll Did this get taken up at the Unconf? I'd be interested in putting together such a package or helping out with an existing effort if one is underway

jonocarroll commented 6 years ago

It didn't, though there was interest. I started the package myself on the flight home but haven't uploaded anything yet. I'll do that tonight and add you as a collaborator (and @adam-gruer since he mentioned he was also interested). Should be do-able. I'm happy to add @softloud and @timchurches too if you're interested.

AliciaSchep commented 6 years ago

Awesome, thanks! I think it'd be great to get things going by adding issues in ggeasy for each helper that might be a good candidates to include. I'll get that started with a few issues.

jonocarroll commented 6 years ago

If anyone's still watching this issue, https://github.com/jonocarroll/ggeasy is now a thing (and it's looking fantastic). If you'd like to contribute you're most welcome to join. I'm also starting a channel in my slack for developer discussions; let me know and I'll add you.