Víctor Gauto
  • Tidytuesday
  • Publicaciones
  • Mapas de Argentina
  • Visualizaciones
  1. 2025
  2. Semana 22

Sitio en construcción

  • Inicio
  • 2025
    • Semana 02
    • Semana 03
    • Semana 04
    • Semana 05
    • Semana 06
    • Semana 07
    • Semana 08
    • Semana 09
    • Semana 10
    • Semana 11
    • Semana 12
    • Semana 13
    • Semana 14
    • Semana 15
    • Semana 16
    • Semana 17
    • Semana 18
    • Semana 19
    • Semana 20
    • Semana 21
    • Semana 22
  • 2024
    • Semana 02
    • Semana 03
    • Semana 04
    • Semana 05
    • Semana 06
    • Semana 07
    • Semana 08
    • Semana 09
    • Semana 10
    • Semana 11
    • Semana 12
    • Semana 13
    • Semana 14
    • Semana 15
    • Semana 16
    • Semana 17
    • Semana 18
    • Semana 19
    • Semana 20
    • Semana 21
    • Semana 22
    • Semana 23
    • Semana 24
    • Semana 25
    • Semana 26
    • Semana 27
    • Semana 28
    • Semana 29
    • Semana 30
    • Semana 31
    • Semana 32
    • Semana 33
    • Semana 34
    • Semana 35
    • Semana 36
    • Semana 37
    • Semana 38
    • Semana 39
    • Semana 40
    • Semana 41
    • Semana 42
    • Semana 43
    • Semana 44
    • Semana 45
    • Semana 46
    • Semana 47
    • Semana 48
    • Semana 49
    • Semana 50
    • Semana 51
    • Semana 52
    • Semana 53
  • 2023
    • Semana 07
    • Semana 12
    • Semana 13
    • Semana 14
    • Semana 15
    • Semana 16
    • Semana 17
    • Semana 18
    • Semana 19
    • Semana 20
    • Semana 21
    • Semana 22
    • Semana 23
    • Semana 24
    • Semana 25
    • Semana 26
    • Semana 27
    • Semana 28
    • Semana 29
    • Semana 30
    • Semana 31
    • Semana 32
    • Semana 33
    • Semana 34
    • Semana 35
    • Semana 36
    • Semana 37
    • Semana 38
    • Semana 39
    • Semana 40
    • Semana 41
    • Semana 42
    • Semana 43
    • Semana 44
    • Semana 45
    • Semana 46
    • Semana 47
    • Semana 48
    • Semana 49
    • Semana 50
    • Semana 51
    • Semana 52

Contenido

  • Paquetes
  • Estilos
  • Epígrafe
  • Datos
  • Procesamiento
  • Figura
  • Editar esta página
  • Informar de un problema
  1. 2025
  2. Semana 22

Semana 22

  • Mostrar todo el código
  • Ocultar todo el código

  • Ver el código fuente
geom_segment
geom_point
geom_marquee
Autor

Víctor Gauto

Fecha de publicación

3 de junio de 2025

Cantidad de libros en español en el Proyecto Gutenberg.

Semana 22, 2025

Paquetes

Ocultar código
library(glue)
library(ggtext)
library(marquee)
library(showtext)
library(tidyverse)

Estilos

Colores. Remplazo el color rojo con el del logo de Gutenberg.

Ocultar código
c1 <- "#E7A8FB"
c2 <- "#F8B150"
c3 <- "#3B3A3E"
c4 <- "#C2D6A4"

Fuentes: Ubuntu y JetBrains Mono.

Ocultar código
font_add(
  family = "ubuntu",
  regular = "././fuente/Ubuntu-Regular.ttf",
  bold = "././fuente/Ubuntu-Bold.ttf",
  italic = "././fuente/Ubuntu-Italic.ttf"
)

font_add(
  family = "jet",
  regular = "././fuente/JetBrainsMonoNLNerdFontMono-Regular.ttf"
)

showtext_auto()
showtext_opts(dpi = 300)

Epígrafe

Ocultar código
fuente <- glue(
  "Datos: <span style='color:{c1};'><span style='font-family:jet;'>",
  "{{<b>tidytuesdayR</b>}}</span> semana 22, ",
  "<b>{{gutenbergr}}</b>.</span>"
)

autor <- glue("<span style='color:{c1};'>**Víctor Gauto**</span>")
icon_twitter <- glue("<span style='font-family:jet;'>&#xf099;</span>")
icon_instagram <- glue("<span style='font-family:jet;'>&#xf16d;</span>")
icon_github <- glue("<span style='font-family:jet;'>&#xf09b;</span>")
icon_mastodon <- glue("<span style='font-family:jet;'>&#xf0ad1;</span>")
icon_bsky <- glue("<span style='font-family:jet;'>&#xe28e;</span>")
usuario <- glue("<span style='color:{c1};'>**vhgauto**</span>")
sep <- glue("**|**")

mi_caption <- glue(
  "{fuente}<br>{autor} {sep} {icon_github} {icon_twitter} {icon_instagram} ",
  "{icon_mastodon} {icon_bsky} {usuario}"
)

Datos

Ocultar código
tuesdata <- tidytuesdayR::tt_load(2025, 22)
gutenberg_metadata <- tuesdata$gutenberg_metadata

Procesamiento

Me interesa la cantidad de libros en español respecto del total.

Ocultar código
n_libros <- nrow(gutenberg_metadata)

n_es <- gutenberg_metadata |>
  filter(language == "es") |>
  nrow()

Defino la cantidad de elementos de cada lado y filtro de acuerdo al idioma.

Ocultar código
lado <- round(sqrt(n_libros))

d <- expand_grid(
  y = rev(1:lado),
  x = 1:lado
) |>
  mutate(nro = row_number()) |>
  mutate(español = nro > n_es) |>
  filter(nro <= n_libros)

Figura

Agrego el estilo de los números totales de libros y los que son en español, y defino el título.

Ocultar código
n_libros_label <- glue("<span style='font-family: jet'>{n_libros}</span>")
n_es_label <- glue("<span style='font-family: jet'>{n_es}</span>")

mi_titulo <- glue(
  "El <b style='color: {c4}'>Proyecto Gutenberg</b> es una biblioteca con 
  <span style='color: {c2}'>**{n_libros_label}** libros disponibles</span>.<br>
  Únicamente <span style='color: {c1}'>{n_es_label} son en **español**.</span>"
)

Figura.

Ocultar código
g <- d |>
  ggplot(aes(x, y)) +
  geom_point(aes(color = español), size = .3, show.legend = FALSE) +
  scale_color_manual(
    breaks = c(FALSE, TRUE),
    values = c(c1, c2)
  ) +
  coord_equal() +
  labs(title = mi_titulo, caption = mi_caption) +
  theme_void(base_family = "ubuntu", base_size = 20) +
  theme(
    plot.background = element_rect(fill = c3, color = NA),
    plot.title = element_markdown(
      color = "white",
      lineheight = 1.3,
      hjust = .5
    ),
    plot.caption = element_markdown(
      color = c2,
      margin = margin(b = 10, r = 30),
      lineheight = 1.3
    )
  )

Guardo

Ocultar código
ggsave(
  plot = g,
  filename = "tidytuesday/2025/semana_22.png",
  width = 30,
  height = 33,
  units = "cm"
)
Subir
Semana 21
2024
Ejecutar el código
---
format:
  html:
    code-fold: show
    code-summary: "Ocultar código"
    code-line-numbers: false
    code-annotations: false
    code-link: true
    code-tools:
        source: true
        toggle: true
        caption: "Código"
    code-overflow: scroll
    page-layout: full
editor_options:
  chunk_output_type: console
categories:
  - geom_segment
  - geom_point
  - geom_marquee
execute:
  eval: false
  echo: true
  warning: false
title: "Semana 22"
date: 2025-06-03
author: Víctor Gauto
---

Cantidad de libros en español en el [Proyecto Gutenberg](https://www.gutenberg.org/).

![Semana 22, 2025](semana_22.png)

## Paquetes

```{r}
library(glue)
library(ggtext)
library(marquee)
library(showtext)
library(tidyverse)
```

## Estilos

Colores. Remplazo el color rojo con el del [logo de Gutenberg](https://files.mastodon.social/accounts/avatars/110/441/535/131/897/219/original/0ddf9d4dd12a5dee.png).

```{r}
c1 <- "#E7A8FB"
c2 <- "#F8B150"
c3 <- "#3B3A3E"
c4 <- "#C2D6A4"
```

Fuentes: Ubuntu y JetBrains Mono.

```{r}
font_add(
  family = "ubuntu",
  regular = "././fuente/Ubuntu-Regular.ttf",
  bold = "././fuente/Ubuntu-Bold.ttf",
  italic = "././fuente/Ubuntu-Italic.ttf"
)

font_add(
  family = "jet",
  regular = "././fuente/JetBrainsMonoNLNerdFontMono-Regular.ttf"
)

showtext_auto()
showtext_opts(dpi = 300)
```

## Epígrafe

```{r}
fuente <- glue(
  "Datos: <span style='color:{c1};'><span style='font-family:jet;'>",
  "{{<b>tidytuesdayR</b>}}</span> semana 22, ",
  "<b>{{gutenbergr}}</b>.</span>"
)

autor <- glue("<span style='color:{c1};'>**Víctor Gauto**</span>")
icon_twitter <- glue("<span style='font-family:jet;'>&#xf099;</span>")
icon_instagram <- glue("<span style='font-family:jet;'>&#xf16d;</span>")
icon_github <- glue("<span style='font-family:jet;'>&#xf09b;</span>")
icon_mastodon <- glue("<span style='font-family:jet;'>&#xf0ad1;</span>")
icon_bsky <- glue("<span style='font-family:jet;'>&#xe28e;</span>")
usuario <- glue("<span style='color:{c1};'>**vhgauto**</span>")
sep <- glue("**|**")

mi_caption <- glue(
  "{fuente}<br>{autor} {sep} {icon_github} {icon_twitter} {icon_instagram} ",
  "{icon_mastodon} {icon_bsky} {usuario}"
)
```

## Datos

```{r}
tuesdata <- tidytuesdayR::tt_load(2025, 22)
gutenberg_metadata <- tuesdata$gutenberg_metadata
```

## Procesamiento

Me interesa la cantidad de libros en **español** respecto del total.

```{r}
n_libros <- nrow(gutenberg_metadata)

n_es <- gutenberg_metadata |>
  filter(language == "es") |>
  nrow()
```

Defino la cantidad de elementos de cada lado y filtro de acuerdo al idioma.

```{r}
lado <- round(sqrt(n_libros))

d <- expand_grid(
  y = rev(1:lado),
  x = 1:lado
) |>
  mutate(nro = row_number()) |>
  mutate(español = nro > n_es) |>
  filter(nro <= n_libros)
```

## Figura

Agrego el estilo de los números totales de libros y los que son en español, y defino el título.

```{r}
n_libros_label <- glue("<span style='font-family: jet'>{n_libros}</span>")
n_es_label <- glue("<span style='font-family: jet'>{n_es}</span>")

mi_titulo <- glue(
  "El <b style='color: {c4}'>Proyecto Gutenberg</b> es una biblioteca con 
  <span style='color: {c2}'>**{n_libros_label}** libros disponibles</span>.<br>
  Únicamente <span style='color: {c1}'>{n_es_label} son en **español**.</span>"
)
```

Figura.

```{r}
g <- d |>
  ggplot(aes(x, y)) +
  geom_point(aes(color = español), size = .3, show.legend = FALSE) +
  scale_color_manual(
    breaks = c(FALSE, TRUE),
    values = c(c1, c2)
  ) +
  coord_equal() +
  labs(title = mi_titulo, caption = mi_caption) +
  theme_void(base_family = "ubuntu", base_size = 20) +
  theme(
    plot.background = element_rect(fill = c3, color = NA),
    plot.title = element_markdown(
      color = "white",
      lineheight = 1.3,
      hjust = .5
    ),
    plot.caption = element_markdown(
      color = c2,
      margin = margin(b = 10, r = 30),
      lineheight = 1.3
    )
  )
```

Guardo

```{r}
ggsave(
  plot = g,
  filename = "tidytuesday/2025/semana_22.png",
  width = 30,
  height = 33,
  units = "cm"
)
```

Creado con y

Víctor Gauto

  • Editar esta página
  • Informar de un problema