# Putting data on maps using R: easier than ever

[This article was first published on

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Using R to add data to maps has been pretty straightforward for a few years now. That said, it seems easier than ever to do things like use map APIs (**R – What You're Doing Is Rather Desperate**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

*e.g.*Google, Open Street Map), overlay quite complex data visualisations (

*e.g.*“heatmap-style” densities) and even generate animations.

A couple of key R packages in this space: ggmap and gganimate. To illustrate, I’ve used data from the recent New Zealand earthquake to generate some static maps and an animation. Here’s the Github repository and a report published at RPubs. Thanks to Florian Teschner for a great ggmap tutorial which got me started.

My own work in bioinformatics to date has not (sadly!) required much analysis of geospatial data but I can see use cases in many areas – environmental microbiology, for example.

Filed under: R, statistics Tagged: earthquakes, ggplot2, maps, new zealand, visualisation

To

**leave a comment**for the author, please follow the link and comment on their blog:**R – What You're Doing Is Rather Desperate**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.