ggplot

A Summer of RStudio and ggplot2

For those of you wondering why I haven’t been tweeting and/or blogging about mud and lakes all summer, it’s because I had the incredible opportunity to spend the summer as an RStudio intern working with Hadley Wickham on ggplot2! It was a welcome change of pace from writing articles about mud in lakes, and I’m sad the internship is coming to a close. I had the opportunity to work alongside a lot of great interns at a fantastic company, prepare tons of issues for tidy-dev-day at UseR!

Visualizing Canadian Climate Normals

I’m an avid Twitter follower of Simon Kuestenmacher (@simongerman600), who is a prolific tweeter of maps (all sorts). The other day I saw this tweet, which links to a reddit thread that used the PRISM dataset to make an animated map of precipitation in the US. A few weeks ago I had a colleague email me asking for the Canadian climate normals raw data (which can be found here), and having made an animated map of Earth’s paleogeography, I decided to give it a go for Canada.

Stratigraphic diagrams with tidypaleo & ggplot2

This post covers creating stratigraphic diagrams using ggplot2, highlighting the helpers contained within the tidypaleo package, which I’ve been using for the past few months to create diagrams. I chose the ggplot2 framework because it is quite flexible and can be used to create almost any time-stratigraphic diagram except ones that involve multiple axes (we can have a fight about whether or not those are appropriate anyway, but if you absolutely need to create them I suggest you look elsewhere).

Modifying facet scales in ggplot2

There is a very old issue in ggplot2 about the ability to modify particular scales when using facet_wrap() or facet_grid(). I often have this problem when using lots of facets, as sometimes the labels overlap with eachother on some of the scales. Without a way to set the breaks on one particular scale, it’s hard to fix this without exporting an SVG and modifying the result (it’s usually possible to fix it by specifying an overall set of breaks, or by rotating the x labels using theme(axis.

Verbifying nouns and using the pipe in ggplot2

There is a lot of talk about the ggplot2 package and the pipe. Should it be used? Some approaches, like the ggpipe package, replace many ggplot2 functions, adding the plot as the first argument so they can be used with the pipe. This ignores the fact that ggplot2 functions construct objects that can (and should) be re-used. Verbifying these noun functions to perform the task of creating the object and updating the plot object is one approach, and recently I wrote an experimental R package that implements it in just under 50 lines of code.