I recently figured out how to do something that I’ve been trying to do for a while: Plot geom_sf objects (spatial points, lines, polygons, etc) onto ggmaps (i.e. basically a google map background), in such a way that everything easily lines up properly. I won’t get into the nitty gritty and ins and outs of all of the components here, or else we’ll be here all day. Instead, I’ll just quickly go through an example and show what worked for me.
I recently gave a talk in which I wanted to show how the overlap between mother and daughter orangutans’ home ranges changed over time. I’d been itching to play around with the gganimate package (created by Thomas Lin Pedersen; his twitter, his github), and it seemed like the perfect opportunity. If you’re already familiar with ggplot2, then gganimate is a breeze. I was really happy with my final result, and figured it’s probably worth a post.
I get a lot of questions about the plots in my conference talks, and I’ve been promissing a post about them, so here’s a first shot. I love plotting, and have recently gotten especially into ggplot2 and some of it’s many options and add-ons. I’ll also include some stats here, to show how to plot the results of of linear mixed model.
A hypothetical hypothesis Let’s say that I want to know: How does DJL (day journey length, see the intro of this post if you want more info about what this means) change over the course of a female orangutan’s development?
When I first discovered colour scales, and started to move away from the simple R base graphics col = "red" style of notation, it took me a while to figure out how to actually use a colour scale in R - how to break it up into distinct colours and tell a plotting function which colour to use for what. When I get stuck on something, I often make a note of it, thinking that once I figure it out, it might be worth a blog post… so here we are.