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

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
    • Semana 23
    • Semana 24
  • 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 24

Semana 24

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

  • Ver el código fuente
geom_col
geom_text
geom_point_svg
Autor

Víctor Gauto

Fecha de publicación

17 de junio de 2025

Cantidad de APIs por categoría.

Semana 24, 2025

Paquetes

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

Estilos

Colores.

Ocultar código
c1 <- "#082844"
c2 <- "#8DADCA"
c3 <- "white"

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 24, ",
  "<b>APIs.guru</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, 24)
api_categories <- tuesdata$api_categories

Procesamiento

Me interesan las categorías de las API.

Ocultar código
d <- count(api_categories, apisguru_category, sort = TRUE) |>
  filter(n >= 10) |>
  mutate(
    categoria = str_replace_all(apisguru_category, "_", " ") |> toupper()
  ) |>
  mutate(
    categoria = fct_reorder(categoria, n)
  ) |>
  mutate(hjust = if_else(n > 10, 1.05, -.05)) |>
  mutate(color = if_else(n > 10, c1, c2))

Figura

Logo y título.

Ocultar código
mi_titulo <- glue(
  "A partir de {nrow(api_categories)} **API**s, estas son las categorías 
  principales."
)

logo_link <- "https://apis.guru/assets/images/logo.svg"
logo_svg <- paste(readLines(logo_link), collapse = "\n")

Figura.

Ocultar código
g <- ggplot(d, aes(n, categoria)) +
  geom_col(fill = c2, color = NA) +
  geom_text(
    aes(label = categoria, hjust = hjust, color = color),
    family = "jet",
    size = 8
  ) +
  ggsvg::geom_point_svg(
    x = I(.985),
    y = I(25.7),
    svg = logo_svg,
    size = 10,
    inherit.aes = FALSE
  ) +
  scale_x_log10() +
  scale_color_identity() +
  coord_cartesian(
    ylim = c(0, nrow(d) + 1),
    xlim = c(.9, 1200),
    expand = FALSE,
    clip = "off"
  ) +
  labs(x = NULL, y = NULL, title = mi_titulo, caption = mi_caption) +
  ggthemes::theme_par(base_size = 15, base_family = "jet") +
  theme(
    aspect.ratio = 1,
    plot.background = element_rect(fill = c2, color = NA),
    plot.title = element_markdown(
      family = "ubuntu",
      color = c1,
      hjust = 0,
      face = "plain"
    ),
    plot.caption = element_markdown(
      family = "ubuntu",
      color = c3,
      margin = margin(t = 20),
      lineheight = 1.2,
      size = 15
    ),
    panel.background = element_rect(fill = c1, color = NA),
    axis.line = element_blank(),
    axis.ticks = element_blank(),
    axis.text.x = element_text(color = c1),
    axis.text.y = element_blank()
  )

Guardo.

Ocultar código
ggsave(
  plot = g,
  filename = "tidytuesday/2025/semana_24.png",
  width = 30,
  height = 30,
  units = "cm"
)
Subir
Semana 23
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_col
  - geom_text
  - geom_point_svg
execute:
  eval: false
  echo: true
  warning: false
title: "Semana 24"
date: 2025-06-17
author: Víctor Gauto
---

Cantidad de APIs por categoría.

![Semana 24, 2025](semana_24.png)

## Paquetes

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

## Estilos

Colores.

```{r}
c1 <- "#082844"
c2 <- "#8DADCA"
c3 <- "white"
```

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 24, ",
  "<b>APIs.guru</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, 24)
api_categories <- tuesdata$api_categories
```

## Procesamiento

Me interesan las categorías de las API.

```{r}
d <- count(api_categories, apisguru_category, sort = TRUE) |>
  filter(n >= 10) |>
  mutate(
    categoria = str_replace_all(apisguru_category, "_", " ") |> toupper()
  ) |>
  mutate(
    categoria = fct_reorder(categoria, n)
  ) |>
  mutate(hjust = if_else(n > 10, 1.05, -.05)) |>
  mutate(color = if_else(n > 10, c1, c2))
```

## Figura

Logo y título.

```{r}
mi_titulo <- glue(
  "A partir de {nrow(api_categories)} **API**s, estas son las categorías 
  principales."
)

logo_link <- "https://apis.guru/assets/images/logo.svg"
logo_svg <- paste(readLines(logo_link), collapse = "\n")
```

Figura.

```{r}
g <- ggplot(d, aes(n, categoria)) +
  geom_col(fill = c2, color = NA) +
  geom_text(
    aes(label = categoria, hjust = hjust, color = color),
    family = "jet",
    size = 8
  ) +
  ggsvg::geom_point_svg(
    x = I(.985),
    y = I(25.7),
    svg = logo_svg,
    size = 10,
    inherit.aes = FALSE
  ) +
  scale_x_log10() +
  scale_color_identity() +
  coord_cartesian(
    ylim = c(0, nrow(d) + 1),
    xlim = c(.9, 1200),
    expand = FALSE,
    clip = "off"
  ) +
  labs(x = NULL, y = NULL, title = mi_titulo, caption = mi_caption) +
  ggthemes::theme_par(base_size = 15, base_family = "jet") +
  theme(
    aspect.ratio = 1,
    plot.background = element_rect(fill = c2, color = NA),
    plot.title = element_markdown(
      family = "ubuntu",
      color = c1,
      hjust = 0,
      face = "plain"
    ),
    plot.caption = element_markdown(
      family = "ubuntu",
      color = c3,
      margin = margin(t = 20),
      lineheight = 1.2,
      size = 15
    ),
    panel.background = element_rect(fill = c1, color = NA),
    axis.line = element_blank(),
    axis.ticks = element_blank(),
    axis.text.x = element_text(color = c1),
    axis.text.y = element_blank()
  )
```

Guardo.

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

Creado con y

Víctor Gauto

  • Editar esta página
  • Informar de un problema