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 ### 27/10/2020 --- exclude: true --- class: middle, center ## SESIÓN 7 ### Data Viz (II) #### Las muchas capas de `ggplot2 +` extensiones #### [
/MetodosCiPol/](https://tuqmano.github.io/MetodosCiPol/) #### [
/MetodosCiPol/](https://github.com/TuQmano/MetodosCiPol) --- class: inverse, center, middle # Sus primeros gráficos --- background-image: url(https://github.com/electorArg/polAr/blob/master/hex/hex-polAr.png?raw=true) background-position: 95% 5% background-size: 10% # Composición de gráficos <img src="Clase7_files/figure-html/unnamed-chunk-1-1.png" width="65%" /> --- background-image: url(https://patchwork.data-imaginist.com/reference/figures/logo.png) background-position: 95% 5% background-size: 10% # Composición de gráficos [
`{patchwork}`](https://patchwork.data-imaginist.com/) ```r library(ggplot2) *library(patchwork) p1 <- ggplot(mtcars) + geom_point(aes(mpg, disp)) p2 <- ggplot(mtcars) + geom_boxplot(aes(gear, disp, group = gear)) *p1 + p2 ``` <img src="Clase7_files/figure-html/unnamed-chunk-2-1.png" width="300" /> --- background-image: url(https://patchwork.data-imaginist.com/reference/figures/logo.png) background-position: 95% 5% background-size: 10% # Composición de gráficos [
`{patchwork}`](https://patchwork.data-imaginist.com/) ```r p3 <- ggplot(mtcars) + geom_smooth(aes(disp, qsec)) p4 <- ggplot(mtcars) + geom_bar(aes(carb)) *(p1 | p2 | p3) / * p4 ``` <img src="Clase7_files/figure-html/unnamed-chunk-3-1.png" width="300" /> --- background-image: url(https://wilkelab.org/cowplot/reference/figures/logo.png) background-position: 95% 5% background-size: 10% ## Composición de gráficos [
`{cowplot}`](https://wilkelab.org/cowplot/index.html) ```r library(cowplot) logo_file <- "https://github.com/electorArg/polAr/blob/master/hex/hex-polAr.png?raw=true" ggdraw(cow_plot) + draw_label(label = "HECHO CON", color = "blue", size = 40, angle = 45 , alpha = .5) + draw_image(logo_file, x = 1, y = 1.1, hjust = 1, vjust = 1, width = 0.15) ``` <img src="Clase7_files/figure-html/unnamed-chunk-5-1.png" width="300" /> --- background-image: url(https://github.com/RobWHickman/ggparliament/raw/master/man/figures/HexSticker.png) background-position: 95% 5% background-size: 10% # Dibujar legislaturas <img src="https://www.tuqmano.com/post/2020-03-15-dibujar-legislaturas_files/figure-html/plot-1.png" width="50%" /> [
`{ggparliament}`](https://patchwork.data-imaginist.com/) | [
blogpost](https://www.tuqmano.com/2020/03/15/dibujar-legislaturas/) --- background-image: url(https://ggforce.data-imaginist.com/reference/figures/logo.png) background-position: 95% 5% background-size: 10% # + Extensiones [
blogpost](https://www.tuqmano.com/2019/04/18/diagramas/) <img src="https://www.tuqmano.com/post/2019-04-18-diagramas_files/figure-html/CODE%20GOT-1.png" width="75%" /> [
Documentación de `geom_parallel_set()`](https://ggforce.data-imaginist.com/reference/geom_parallel_sets.html) de [
`{ggforce}`](https://ggforce.data-imaginist.com/) --- ## MISC ### Themes * `{ggthemes}` <https://jrnold.github.io/ggthemes/index.html> * `{hrbthemes}` <https://cinc.rud.is/web/packages/hrbrthemes/> -- ### Fonts * `{extrafont}` <https://github.com/wch/extrafont> -- ### `+` * `{ggtern}` <https://github.com/nicholasehamilton/ggtern> * `{plotly}` <https://plotly-r.com/> * **The `R` Graph Gallery** <https://www.r-graph-gallery.com/> --- class: inverse, middle, center # *Data Viz* con tabulados --- background-image: url(https://github.com/rstudio/gt/raw/master/man/figures/logo.svg) background-position: 95% 5% background-size: 10% ## Una gramática para tablas [
`{gt}`](https://github.com/rstudio/gt) <img src="https://github.com/rstudio/gt/raw/master/man/figures/gt_parts_of_a_table.svg" width="90%" /> **OTROS:** [
`{kableExtra}`](https://haozhu233.github.io/kableExtra/) | [
`{formattable}`](https://renkun-ken.github.io/formattable/) | [
`{DT}`](https://rstudio.github.io/DT/) | [
`{stargazer}`](https://cran.r-project.org/web/packages/stargazer/index.html) --- class: middle, center # Práctica con **datos** de #MétodosCiPol ### <https://tuqmano.github.io/MetodosCiPol/datos.html>