class: center, middle, inverse, title-slide # Herramientas Cuantitativas para el Análisis Político ## [CP44] Maestría en Ciencia Política ### Juan Pablo Ruiz Nicolini ### Universidad Torcuato Di Tella ### 03/11/2020 --- exclude: true --- class: middle, center ## SESIÓN 8 ### Data Viz (III) #### `GEO` #### [
/MetodosCiPol/](https://tuqmano.github.io/MetodosCiPol/) #### [
/MetodosCiPol/](https://github.com/TuQmano/MetodosCiPol) --- class: center, middle # Sus gráficos (**`v2.0`**) --- ##
Referencias * R - Spatial <https://www.r-spatial.org/> * [*Geocomputation with R*, Robin Lovelace, Jakub Nowosad, Jannes Muenchow (2019)](Robin Lovelace, Jakub Nowosad, Jannes Muenchow) --- ## #Election2020 > **"_Trump loves this 2016 election map because it suggests the majority of the country supports him (...)_"** **([NYT](https://www.nytimes.com/interactive/2020/10/30/opinion/election-results-maps.html))** <img src="figs/nyt.PNG" width="100%" /> --- background-image: url(https://user-images.githubusercontent.com/520851/34887433-ce1d130e-f7c6-11e7-83fc-d60ad4fae6bd.gif) background-position: 95% 5% background-size: 10% ### Datos Espaciales Simplificados <img src="https://user-images.githubusercontent.com/520851/50280460-e35c1880-044c-11e9-9ed7-cc46754e49db.jpg" width="80%" /> --- background-image: url(https://user-images.githubusercontent.com/520851/34887433-ce1d130e-f7c6-11e7-83fc-d60ad4fae6bd.gif) background-position: 95% 5% background-size: 10% ## _Simple Features_ <img src="https://r-spatial.github.io/sf/articles/sf_xfig.png" width="80%" /> [
`{sf}`](https://r-spatial.github.io/sf/) --- background-image: url(https://user-images.githubusercontent.com/520851/34887433-ce1d130e-f7c6-11e7-83fc-d60ad4fae6bd.gif) background-position: 95% 5% background-size: 10% ### Poligonos desde `{polAr}` ```r polAr::get_geo("TUCUMAN") %>% # Descargro geometry de TUCUMAN plot() ``` <img src="Clase8_files/figure-html/unnamed-chunk-4-1.png" width="300" /> --- background-image: url(https://user-images.githubusercontent.com/520851/34887433-ce1d130e-f7c6-11e7-83fc-d60ad4fae6bd.gif) background-position: 95% 5% background-size: 10% ### Uso con `{ggplot2}` ```r map_tuc <- get_geo("TUCUMAN") ggplot(map_tuc) + * geom_sf() + * geom_sf_label(aes(label = coddepto)) ``` <img src="Clase8_files/figure-html/unnamed-chunk-5-1.png" width="300" /> --- background-image: url(https://www.kevinzolea.com/img/headers/leaflet.png) background-position: 95% 5% background-size: 20% ### Mapas interactivos [
`{leaflet}`](https://rstudio.github.io/leaflet/)
--- background-image: url(https://www.kevinzolea.com/img/headers/leaflet.png) background-position: 95% 5% background-size: 20% ### Mapas interactivos [
`{leaflet}`](https://rstudio.github.io/leaflet/) ```r *library(leaflet) # tucson <- polAr::get_geo("TUCUMAN) leaflet(tucson) %>% #Dibuja Polygons * addPolygons() %>% #Agrega fondo * addProviderTiles(providers$Stamen.Toner) ```
--- background-image: url(https://www.kevinzolea.com/img/headers/leaflet.png) background-position: 95% 5% background-size: 20% ### Dónde deberiamos estar ahora? ```r leaflet() %>% * #Dibuja MARCADOR * addMarkers(lng = -58.4469439, -34.5480059) %>% #Agrega fondo addProviderTiles(providers$OpenStreetMap) ```
--- background-image: url(https://www.kevinzolea.com/img/headers/leaflet.png) background-position: 95% 5% background-size: 20% ### Dónde deberiamos estar ahora? ```r leaflet() %>% #Dibuja MARCADOR addMarkers(lng = -58.4469439, -34.5480059) %>% * #Agrega fondo con otro TILE * addProviderTiles(providers$Stamen.Watercolor) ```
--- background-image: url(https://hafen.github.io/geofacet/reference/figures/logo.png) background-position: 95% 5% background-size: 10% # Grillas como (si fueran) mapas [
`{geofacet}`](https://ryanhafen.com/blog/geofacet/) <img src="Clase8_files/figure-html/unnamed-chunk-11-1.png" width="80%" /> [
_Voto Popular_ vs _Colegio Electoral_](https://github.com/TuQmano/popular_vote) --- background-image: url(https://hafen.github.io/geofacet/reference/figures/logo.png) background-position: 95% 5% background-size: 10% # [Grillas colaborativas](https://github.com/hafen/geofacet/issues/102) ```r library(geofacet) grid_preview(argentina_grid2) ``` <img src="Clase8_files/figure-html/unnamed-chunk-12-1.png" width="35%" /> --- background-image: url(https://github.com/electorArg/geofaceteAR/blob/master/hex/ggplot2.png?raw=true) background-position: 95% 5% background-size: 10% # Las grillas de Argentina #### **LatinR 2018**: [Abstract](https://github.com/TuQmano/geofacet_ARG/blob/master/.LatinR/Geofaceting_Argentina_RuizNicolini.pdf) #### [📊 Slides](https://www.researchgate.net/publication/327382101_Geofaceting_Argentina_LatinR_2018) #### [📦 {geofaceteAR}](https://electorarg.github.io/geofaceteAR/) #### [⌨️ blogpost](https://www.tuqmano.com/2020/05/22/empaquetar/) <img src="Clase8_files/figure-html/unnamed-chunk-13-1.png" width="300" style="display: block; margin: auto auto auto 0;" /> --- class: inverse, center, middle # Mapas con {polAr} ## caba2009 --- background-image: url(https://github.com/electorArg/polAr/blob/master/hex/hex-polAr.png?raw=true) background-position: 95% 5% background-size: 10% #### `map_results(caba2009)` <img src="Clase8_files/figure-html/unnamed-chunk-14-1.png" width="80%" /> --- background-image: url(https://github.com/electorArg/polAr/blob/master/hex/hex-polAr.png?raw=true) background-position: 95% 5% background-size: 10% #### `plot_results(caba2009)` <img src="Clase8_files/figure-html/unnamed-chunk-15-1.png" width="80%" /> --- background-image: url(https://github.com/electorArg/polAr/blob/master/hex/hex-polAr.png?raw=true) background-position: 95% 5% background-size: 10% class: center, middle # Su turno ### Replicar mapa estilo `polAr` con la provincia asignada en el *Ejercicio 1* --- class: middle, reverse # Práctica: un gráfico por día <img src="https://pbs.twimg.com/media/ElxsT_TWkAAzUJd?format=jpg&name=medium" width="80%" />