class: left, bottom, my-title, title-slide # Reproducible spatial data visualization with R ## R-spatial panel | FOSS4G 2021 ### Lorena Abad ### 30-09-2021 --- class: middle, center ## How? -- with .emph[**3**] simple steps... -- and a menu of packages to choose from! .left[.footnote[[Code to reproduce](https://github.com/loreabad6/MapArt/blob/master/data.R) title slide image.]] --- ## Step 1: Get some data! -- .center[ <a href="https://docs.ropensci.org/rnaturalearth/"><img src="https://docs.ropensci.org/rnaturalearth/hexlogo.png" width="250px"; height="300px"/></a> <a href="https://github.com/walkerke/tigris"><img src="https://raw.githubusercontent.com/walkerke/tigris/master/tools/readme/tigris_sticker.png" width="250px"; height="300px"/></a> <a href="https://github.com/ipeaGIT/geobr"><img src="https://github.com/ipeaGIT/geobr/raw/master/r-package/man/figures/geobr_logo_b.png?raw=true" width="250px"; height="300px"/></a> <a href="https://github.com/ropensci/osmdata"><img src="https://docs.ropensci.org/osmdata/reference/figures/osmhex.png" width="250px"; height="300px"/></a> ] <br> - rnaturalearth - tigris - osmdata -- - **Your own data!** --- ## Step 2: Bring it into R .center[ <a href="https://github.com/r-spatial/sf"><img src="https://raw.githubusercontent.com/loreabad6/sfnetworks_WiG/main/figs/sf.png" width="250px"/></a> <a href="https://github.com/rspatial/terra"><img src="https://raw.githubusercontent.com/rspatial/terra/master/man/figures/logo.png" width="250px"/></a> ] <br> - sf - stars - terra (successor of raster) --- ## Step 3: Map it! -- ### Static .center[ <a href="https://github.com/tidyverse/ggplot2"><img src="https://raw.githubusercontent.com/tidyverse/ggplot2/master/man/figures/logo.png" width="200px"/></a> <a href="https://github.com/mtennekes/tmap"><img src="https://user-images.githubusercontent.com/3457131/78889069-479c5480-7a63-11ea-9d76-e8a0acc55c3f.png" width="200px"/></a> <a href="https://github.com/riatelab/mapsf"><img src="https://raw.githubusercontent.com/riatelab/mapsf/master/man/figures/logo.png" width="200px"/></a> ] <br> - Base R - ggplot2 (+ [ggspatial](https://github.com/paleolimbot/ggspatial)) - tmap - mapsf --- ## Step 3: Map it! ### Interactive .center[ <a href="https://github.com/mtennekes/tmap"><img src="https://user-images.githubusercontent.com/3457131/78889069-479c5480-7a63-11ea-9d76-e8a0acc55c3f.png" width="200px"/></a> <a href="https://github.com/r-spatial/mapview/"><img src="https://github.com/tim-salabim/mvl/blob/cstriestohelp/imagery/animated/box_anim.gif?raw=true" width="200px"/></a> ] <br> - tmap - mapview - [mapdeck](https://github.com/SymbolixAU/mapdeck/) - [leaflet](https://rstudio.github.io/leaflet/) - [rayshader](https://github.com/tylermorganwall/rayshader) --- ## Get started! - [Geocomputation with R](https://geocompr.robinlovelace.net/adv-map.html) - Drawing beautiful maps programmatically with R, sf and ggplot 2 [part 1](https://r-spatial.org/r/2018/10/25/ggplot2-sf.html), [part 2](https://r-spatial.org/r/2018/10/25/ggplot2-sf-2.html) and [part 3](https://r-spatial.org/r/2018/10/25/ggplot2-sf-3.html) --- ## Bonus: Get inspired! - [#TidyTuesday](https://twitter.com/search?q=%23tidytuesday) - [#30DayMapChallenge](https://twitter.com/search?q=%2330daymapchallenge) - [#rspatial](https://twitter.com/search?q=%23rspatial&f=image) --- class: center, middle <center> <blockquote class="twitter-tweet"><p lang="en" dir="ltr">First time doing spatial analysis for <a href="https://twitter.com/hashtag/TidyTuesday?src=hash&ref_src=twsrc%5Etfw">#TidyTuesday</a>! I also imported another data set to further classify meteorites. Code can be found at: <a href="https://t.co/ruIA6VqfXR">https://t.co/ruIA6VqfXR</a> <a href="https://t.co/qfhFGkKMCf">pic.twitter.com/qfhFGkKMCf</a></p>— Catherine Williams (@catrwilliams) <a href="https://twitter.com/catrwilliams/status/1138895137331748865?ref_src=twsrc%5Etfw">June 12, 2019</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> </center> .left[.footnote[[Code to reproduce](https://github.com/catrwilliams/rprojects/blob/master/tidytuesday/Meteorites.Rmd)]] --- class: center, middle <center> <blockquote class="twitter-tweet"><p lang="en" dir="ltr">A map and a barplot for <a href="https://twitter.com/hashtag/TidyTuesday?src=hash&ref_src=twsrc%5Etfw">#TidyTuesday</a>, happy independence day! From where did countries declare independence? <a href="https://twitter.com/hashtag/rstats?src=hash&ref_src=twsrc%5Etfw">#rstats</a> <a href="https://twitter.com/hashtag/dataviz?src=hash&ref_src=twsrc%5Etfw">#dataviz</a><br><br>Code: <a href="https://t.co/Hh0yHc49Eh">https://t.co/Hh0yHc49Eh</a> <a href="https://t.co/H0F9lJU73u">pic.twitter.com/H0F9lJU73u</a></p>— Julianna Calabrese (@jrosecalabrese) <a href="https://twitter.com/jrosecalabrese/status/1412562195636969474?ref_src=twsrc%5Etfw">July 7, 2021</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> </center> .left[.footnote[[Code to reproduce](https://github.com/jrcalabrese/TidyTuesday/blob/main/2021_week28/independence.Rmd)]] --- class: center, middle <center> <blockquote class="twitter-tweet"><p lang="en" dir="ltr">This is my first map done in R! Could not thank <a href="https://twitter.com/jrosecalabrese?ref_src=twsrc%5Etfw">@jrosecalabrese</a> enough for producing such comprehensive and easy-to-follow code. In order to be more creative, I am looking for a resource on mapping in R -- appreciate any recommendation :) <a href="https://twitter.com/hashtag/TidyTuesday?src=hash&ref_src=twsrc%5Etfw">#TidyTuesday</a> <a href="https://twitter.com/hashtag/RStats?src=hash&ref_src=twsrc%5Etfw">#RStats</a> <a href="https://t.co/Q5EHlG4uRu">pic.twitter.com/Q5EHlG4uRu</a></p>— chan (@CTrakulmaykee) <a href="https://twitter.com/CTrakulmaykee/status/1413376512229658631?ref_src=twsrc%5Etfw">July 9, 2021</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> </center> --- class: center, middle <center> <blockquote class="twitter-tweet"><p lang="en" dir="ltr">I've already learned lots of things thanks to the <a href="https://twitter.com/hashtag/30DayMapChallenge?src=hash&ref_src=twsrc%5Etfw">#30DayMapChallenge</a> - one major win is to get to know <a href="https://twitter.com/Natural_Earth?ref_src=twsrc%5Etfw">@Natural_Earth</a> and the resp. <a href="https://twitter.com/hashtag/rstats?src=hash&ref_src=twsrc%5Etfw">#rstats</a>📦{rnaturalearth} 🌐 by <a href="https://twitter.com/rOpenSci?ref_src=twsrc%5Etfw">@rOpenSci</a>! Made my catch-up contribution for today's challenge "zones" very easy 🦸♂️<a href="https://twitter.com/hashtag/ggplot2?src=hash&ref_src=twsrc%5Etfw">#ggplot2</a> <a href="https://twitter.com/hashtag/tidyverse?src=hash&ref_src=twsrc%5Etfw">#tidyverse</a> <a href="https://twitter.com/hashtag/dataviz?src=hash&ref_src=twsrc%5Etfw">#dataviz</a> <a href="https://t.co/AVs8VfVmw4">pic.twitter.com/AVs8VfVmw4</a></p>— Cédric Scherer (@CedScherer) <a href="https://twitter.com/CedScherer/status/1196131149074063361?ref_src=twsrc%5Etfw">November 17, 2019</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> </center> .left[.footnote[[Code to reproduce](https://github.com/z3tt/30DayMapChallenge/blob/master/contributions/Day17_Zones/17_Zones.Rmd)]] --- class: center, middle <center> <blockquote class="twitter-tweet"><p lang="en" dir="ltr">New <a href="https://twitter.com/hashtag/dataviz?src=hash&ref_src=twsrc%5Etfw">#dataviz</a>! The Earth's submarine fiber optic cable network, visualized in <a href="https://twitter.com/hashtag/RStats?src=hash&ref_src=twsrc%5Etfw">#RStats</a> with <a href="https://twitter.com/hashtag/rayrender?src=hash&ref_src=twsrc%5Etfw">#rayrender</a>. <br><br>Code:<a href="https://t.co/6tFsS4vfAK">https://t.co/6tFsS4vfAK</a><br><br>Rayrender Github:<a href="https://t.co/iB5nWhGY7l">https://t.co/iB5nWhGY7l</a> <a href="https://t.co/1FTKM0FPHr">pic.twitter.com/1FTKM0FPHr</a></p>— Tyler Morgan-Wall (@tylermorganwall) <a href="https://twitter.com/tylermorganwall/status/1440669533157556227?ref_src=twsrc%5Etfw">September 22, 2021</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> </center> .left[.footnote[[Code to reproduce](https://gist.github.com/tylermorganwall/b222fcebcac3de56a6e144d73d166322)]] --- class: center, middle <center> <blockquote class="twitter-tweet"><p lang="es" dir="ltr">En <a href="https://twitter.com/eitbNoticias?ref_src=twsrc%5Etfw">@eitbNoticias</a> han usado mis mapas de crecimiento para explicar el efecto de la isla de calor en Bilbao. 🤩 <a href="https://t.co/7dGydGKHad">pic.twitter.com/7dGydGKHad</a></p>— Dr. Dominic Royé (@dr_xeo) <a href="https://twitter.com/dr_xeo/status/1405540316552126470?ref_src=twsrc%5Etfw">June 17, 2021</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> </center> .left[.footnote[[Link to blogpost in Spanish](https://dominicroye.github.io/es/2019/visualizar-el-crecimiento-urbano/)]] --- class: center, middle # Thanks! Contact:
<i class="fab fa-twitter faa-wrench " style=" color:#0a656e;"></i> [**@loreabad6**](https://twitter.com/loreabad6)
<i class="fab fa-github faa-wrench " style=" color:#0a656e;"></i> [**loreabad6**](https://github.com/loreabad6)
.left[.footnote[Slides created via the R package [**xaringan**](https://github.com/yihui/xaringan).]]