theme_tidybde: BdE theme for 'ggplot2'

View source: R/theme-tidybde.R

theme_tidybdeR Documentation

BdE theme for ggplot2

Description

A custom ggplot2 theme based on BdE publications.

Usage

theme_tidybde(...)

Arguments

...

Arguments passed on to ggplot2::theme_classic

base_size

base font size, given in pts.

base_family

base font family

header_family

font family for titles and headers. The default, NULL, uses theme inheritance to set the font. This setting affects axis titles, legend titles, the plot title and tag text.

base_line_size

base size for line elements

base_rect_size

base size for rect elements

ink,paper,accent

colour for foreground, background, and accented elements respectively.

Details

This theme extends ggplot2::theme_classic().

Value

A ggplot2 theme object.

See Also

ggplot2::theme_classic() for the base theme extended here.

Plotting functions: bde_tidy_palettes(), scales_bde

Examples



library(ggplot2)
library(dplyr)
library(tidyr)

series_TC <- bde_series_full_load("TC_1_1.csv")

# Plot if the download succeeds.
if (nrow(series_TC) > 0) {
  series_TC <- series_TC[c(1, 2)]

  series_TC_pivot <- series_TC |>
    filter(
      Date >= "2020-01-01" & Date <= "2020-12-31",
      !is.na(series_TC[[2]])
    )

  names(series_TC_pivot) <- c("x", "y")

  ggplot(series_TC_pivot, aes(x = x, y = y)) +
    geom_line(linewidth = 0.8, color = bde_tidy_palettes(n = 1)) +
    labs(
      title = "Title",
      subtitle = "Some metric",
      caption = "Banco de España"
    ) +
    theme_tidybde()
}



tidyBdE documentation built on July 7, 2026, 1:06 a.m.