| Title: | EKIO Visual Identity for 'ggplot2' |
|---|---|
| Description: | Implements EKIO's visual identity for data visualization with 'ggplot2'. Supplies a coordinated theme, color palettes, discrete and continuous scales, and helpers for accessible text contrast. Includes high-level recipes for common charts so analysts can create consistent, publication-ready graphics with concise code. |
| Authors: | Vinicius Oike [aut, cre, cph] (ORCID: <https://orcid.org/0009-0005-8015-9189>) |
| Maintainer: | Vinicius Oike <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.1.2 |
| Built: | 2026-10-02 18:44:23 UTC |
| Source: | https://github.com/viniciusoike/ekioplot |
Municipal production of soybeans, corn and sugarcane from IBGE's Municipal Agricultural Production Survey (PAM).
brazil_agriculturebrazil_agriculture
A tibble with 16,689 rows and 12 variables:
IBGE municipality code (numeric)
Municipality name (character)
State name (character)
Brazilian region (character)
Crop name (character)
Production volume, tonnes (numeric)
Harvested area, hectares (numeric)
Productivity, tonnes per hectare (numeric)
Crop cycle (character)
Crop category (character)
Economic importance (character)
Production-scale category (integer)
IBGE, Table 1612: Municipal Agricultural Production (PAM). https://sidra.ibge.gov.br/tabela/1612
IBGE. (2023). Produção Agrícola Municipal - PAM 2022.
Annual production of seven major crops by Brazilian state from IBGE's Municipal Agricultural Production Survey (PAM).
brazil_agriculture_statesbrazil_agriculture_states
A tibble with 9,450 rows and 8 variables:
IBGE state code (numeric)
State name (character)
Observation year (numeric)
Crop name (character)
Production volume, tonnes (numeric)
Harvested area, hectares (numeric)
Productivity, kilograms per hectare (numeric)
Production value, thousands of Brazilian reais (numeric)
Crops are beans, corn, cotton, rice, soybeans, sugarcane and wheat.
IBGE, Table 1612: Municipal Agricultural Production (PAM). https://sidra.ibge.gov.br/tabela/1612
IBGE. (2023). Produção Agrícola Municipal - PAM 2022.
Municipal GDP for all 5,570 Brazilian municipalities, at current prices.
brazil_gdpbrazil_gdp
A tibble with 5,570 rows and 7 variables:
IBGE municipality code (numeric)
Municipality name (character)
IBGE state code (numeric)
State name (character)
Observation year (numeric)
GDP, thousands of Brazilian reais (numeric)
GDP, millions of Brazilian reais (numeric)
IBGE, Table 5938: GDP and other aggregates by municipality. https://sidra.ibge.gov.br/tabela/5938
IBGE. (2023). Produto Interno Bruto dos Municípios - 2021.
Population estimates for Brazil's 338 municipalities with more than 100,000 inhabitants.
brazil_populationbrazil_population
A tibble with 338 rows and 5 variables:
Population rank (numeric)
Municipality name (character)
State abbreviation (character)
2025 population estimate (numeric)
Ordered city-size category (factor)
Categories are Metropolis (1M+), Large city (500K–1M), Medium city (200K–500K) and Small city (100K–200K).
IBGE, Table 6579: Municipal population estimates. https://sidra.ibge.gov.br/tabela/6579
Population projections for Brazil at five-year intervals, by five-year age group and sex. The data are a transformed subset of the United Nations World Population Prospects 2024, Online Edition.
brazil_population_forecastbrazil_population_forecast
A tibble with 336 rows and 15 variables:
WPP country or area code (numeric)
Country or area name (character)
Projection year (integer)
Five-year age band, from 0–4 to 100+ (ordered factor)
Age group derived by ekioplot: 0–14, 15–64 or 65+ (ordered factor)
Age group derived by ekioplot: 0–19, 20–29, 30–39, 40–49, 50–59, 60–69, 70–79 or 80+ (ordered factor)
Medium-variant projected male population, in persons (numeric)
Medium-variant projected female population, in persons (numeric)
Medium-variant projected total population, in persons (numeric)
Low-variant projected male population, in persons (numeric)
High-variant projected male population, in persons (numeric)
Low-variant projected female population, in persons (numeric)
High-variant projected female population, in persons (numeric)
Low-variant projected total population, in persons (numeric)
High-variant projected total population, in persons (numeric)
The dataset contains 16 projection years (2025–2100) and 21 age bands. WPP reports values in thousands; ekioplot converts them to persons and rounds them to the nearest person. The two aggregate age-group variables are derived by ekioplot from the WPP five-year bands.
The *_low and *_high columns are WPP low- and high-fertility variants,
respectively. They are alternative scenarios, not probability intervals.
Data © United Nations, 2024. Source data are made available under CC BY 3.0 IGO. This is a transformed subset prepared by ekioplot; the United Nations does not endorse ekioplot or this dataset.
United Nations, Department of Economic and Social Affairs, Population Division (2024). World Population Prospects 2024, Online Edition. https://www.un.org/development/desa/pd/content/world-population-prospects-2024
United Nations Population Division (2024). wpp2024: World Population Prospects 2024. R package. https://github.com/PPgp/wpp2024
Professional area plot with smart aesthetic detection. Supports stacked and filled (proportional) area charts.
ekio_areaplot( data, x, y, fill = NULL, palette = NULL, position = "stack", alpha = 1, title = NULL, subtitle = NULL, caption = NULL, ... )ekio_areaplot( data, x, y, fill = NULL, palette = NULL, position = "stack", alpha = 1, title = NULL, subtitle = NULL, caption = NULL, ... )
data |
A data frame |
x |
X-axis variable (supports data-masking) |
y |
Y-axis variable (supports data-masking) |
fill |
Fill aesthetic. A color string or a discrete variable. A
continuous variable is an error: bin it or wrap it in |
palette |
Character. Palette name for variable mappings. |
position |
Character. Stacking method: |
alpha |
Numeric. Fill transparency (default: 1). |
title, subtitle, caption
|
Plot labels. NULL (default) draws none. |
... |
Additional arguments passed to |
ggplot2 object
ekio_areaplot(ggplot2::economics, date, unemploy) # Stacked area with normalized economic series economic_series <- subset( ggplot2::economics_long, variable %in% c("pce", "psavert", "uempmed") ) ekio_areaplot(economic_series, date, value01, fill = variable)ekio_areaplot(ggplot2::economics, date, unemploy) # Stacked area with normalized economic series economic_series <- subset( ggplot2::economics_long, variable %in% c("pce", "psavert", "uempmed") ) ekio_areaplot(economic_series, date, value01, fill = variable)
Professional bar plot with smart aesthetic detection.
ekio_barplot( data, x, y, fill = NULL, palette = NULL, horizontal = FALSE, bar_width = 0.8, title = NULL, subtitle = NULL, caption = NULL, ... )ekio_barplot( data, x, y, fill = NULL, palette = NULL, horizontal = FALSE, bar_width = 0.8, title = NULL, subtitle = NULL, caption = NULL, ... )
data |
A data frame |
x |
X-axis variable (supports data-masking) |
y |
Y-axis variable (supports data-masking) |
fill |
Fill aesthetic. A color string or a discrete variable. A
continuous variable is an error: bin it or wrap it in |
palette |
Character. Palette name for variable mappings. |
horizontal |
Logical. Create horizontal bar plot (default: FALSE) |
bar_width |
Bar width (default: 0.8) |
title, subtitle, caption
|
Plot labels. NULL (default) draws none. |
... |
Additional arguments passed to |
ggplot2 object
cyl_counts <- as.data.frame(table(cyl = mtcars$cyl)) names(cyl_counts)[2] <- "n" ekio_barplot(cyl_counts, cyl, n)cyl_counts <- as.data.frame(table(cyl = mtcars$cyl)) names(cyl_counts)[2] <- "n" ekio_barplot(cyl_counts, cyl, n)
Computes the contrast ratio between foreground and background colors as defined by WCAG 2.1. Ratios range from 1 (no contrast) to 21 (black on white). WCAG requires at least 4.5 for normal text (level AA), 3.0 for large text (AA), and 7.0 for normal text at level AAA.
ekio_contrast(color, background = "white")ekio_contrast(color, background = "white")
color |
Character. Foreground color(s) as hex codes or R color names. |
background |
Character. Background color(s) (default: |
Numeric vector of contrast ratios between 1 and 21
ekio_text_on() to pick a readable text color for a background
ekio_contrast("black", "white") ekio_contrast(ekio_pal("blue")["700"]) ekio_contrast("white", ekio_pal("blue"))ekio_contrast("black", "white") ekio_contrast(ekio_pal("blue")["700"]) ekio_contrast("white", ekio_pal("blue"))
Professional histogram with smart aesthetic detection.
ekio_histogram( data, x, fill = NULL, palette = NULL, bins = "sturges", binwidth = NULL, border_color = "white", title = NULL, subtitle = NULL, caption = NULL, ... )ekio_histogram( data, x, fill = NULL, palette = NULL, bins = "sturges", binwidth = NULL, border_color = "white", title = NULL, subtitle = NULL, caption = NULL, ... )
data |
A data frame |
x |
Variable to plot (supports data-masking) |
fill |
Fill aesthetic. A color string or a discrete variable. NULL uses
EKIO blue. A continuous variable is an error: bin it or wrap it in
|
palette |
Character. Palette name for variable mappings. |
bins |
Binning method: "sturges", "FD", "scott", or numeric. |
binwidth |
Width of bins (overrides bins if specified) |
border_color |
Color for histogram outline (default: "white") |
title, subtitle, caption
|
Plot labels. NULL (default) draws none. |
... |
Additional arguments passed to |
ggplot2 object
ekio_histogram(mtcars, mpg) ekio_histogram(mtcars, mpg, fill = "steelblue") ekio_histogram(mtcars, mpg, fill = factor(cyl), palette = "full")ekio_histogram(mtcars, mpg) ekio_histogram(mtcars, mpg, fill = "steelblue") ekio_histogram(mtcars, mpg, fill = factor(cyl), palette = "full")
Professional line plot with smart aesthetic detection.
ekio_lineplot( data, x, y, color = NULL, palette = NULL, add_zero = FALSE, line_width = 0.8, title = NULL, subtitle = NULL, caption = NULL, ... )ekio_lineplot( data, x, y, color = NULL, palette = NULL, add_zero = FALSE, line_width = 0.8, title = NULL, subtitle = NULL, caption = NULL, ... )
data |
A data frame |
x |
X-axis variable (supports data-masking) |
y |
Y-axis variable (supports data-masking) |
color |
Color aesthetic. A color string or a discrete variable. A
continuous variable is an error: bin it or wrap it in |
palette |
Character. Palette name for variable mappings. |
add_zero |
Logical. Add horizontal line at y=0 (default: FALSE) |
line_width |
Line thickness (default: 0.8) |
title, subtitle, caption
|
Plot labels. NULL (default) draws none. |
... |
Additional arguments passed to |
ggplot2 object
ekio_lineplot(ggplot2::economics, date, unemploy)ekio_lineplot(ggplot2::economics, date, unemploy)
Returns colors for data visualization and EKIO identity work. Includes EKIO
brand scales, accent and categorical palettes, the ekio_brand identity
palette, the EKIO Academy palettes, and standard scientific palettes.
When printed interactively, displays the palette as a colored swatch with
hex labels.
ekio_pal(palette = "full", n = NULL, reverse = FALSE)ekio_pal(palette = "full", n = NULL, reverse = FALSE)
palette |
Character. Name of the palette. See |
n |
Integer or NULL. Number of colors to return. If NULL, returns all,
except |
reverse |
Logical. If TRUE, reverses the palette order. |
Brand scales ("blue", "gray", "stone", "teal", "green",
"orange", "red", "purple") are nine-step ramps running light to dark,
named by shade. Position and shade are aligned by construction, so
ekio_pal("blue")[7] and ekio_pal("blue")["700"] are the same color.
Subsetting drops the names. A color picked out of a scale goes straight
into ggplot2::scale_color_manual(), which reads names as data levels.
The whole palette keeps its names for ekio_text_on() and for lookup.
The named "ekio_brand" palette contains colors for EKIO identity assets.
It is not intended as a general-purpose data visualization palette.
The "academy" palettes, "yoro_blue" and "yoro_green", are for EKIO
Academy tutorials and books. They come from Hokusai's Yoro Waterfall in
Mino Province and are tuned for theme_ekio(background = "cold"). Each is
a five-step ramp, light to dark, and the two share one lightness per step.
Steps 4 and 5 are dark enough for text on the cold surface.
"full_light" and "spectrum_light" are lighter categorical palettes for
filled marks such as bars, boxplots, and areas. "full_light" keeps the
order of "full", so neighboring colors differ in hue. "spectrum_light"
follows the color wheel from blue to purple, which suits ordered
categories.
"gold" is an accent rather than a scale: three colors named "light",
"mid" and "deep", because a nine-step gold ramp turns brown at the
dark end. They sit on the same lightness rungs as scale shades 300, 400
and 500.
"accent_blue" and "accent_orange" put one main color before a sequence
of receding grays. They return four colors by default; n can be set from
2 to 6 to match the number of series while keeping the main color first.
Object of class ekio_palette (a character vector of hex
codes). Printing displays a visual swatch. Use as.character() to
strip the class.
The brand scales are generated from one OKLCH specification in
data-raw/build-ramps.R: a shared lightness spine anchored on the brand
navy, a shared chroma arc, and a hue path per family. The scientific
palettes come from matplotlib ("viridis", "inferno", "plasma") and
from Okabe & Ito ("okabe_ito"). Notices are in inst/COPYRIGHTS.
ekio_pal("full") ekio_pal("full", n = 4) ekio_pal("full", reverse = TRUE) ekio_pal("full_light") ekio_pal("spectrum_light") ekio_pal("accent_blue", n = 5) ekio_pal("okabe_ito") ekio_pal("ekio_brand") ekio_pal("yoro_blue") # Brand scales are named by shade; position i is shade i * 100 ekio_pal("blue")["700"] ekio_pal("blue")[7] # gold is an accent, named rather than numbered ekio_pal("gold")["mid"] # Subsets are unnamed, so a hand-built palette needs no unname() c(ekio_pal("blue")["700"], ekio_pal("orange")["500"])ekio_pal("full") ekio_pal("full", n = 4) ekio_pal("full", reverse = TRUE) ekio_pal("full_light") ekio_pal("spectrum_light") ekio_pal("accent_blue", n = 5) ekio_pal("okabe_ito") ekio_pal("ekio_brand") ekio_pal("yoro_blue") # Brand scales are named by shade; position i is shade i * 100 ekio_pal("blue")["700"] ekio_pal("blue")[7] # gold is an accent, named rather than numbered ekio_pal("gold")["mid"] # Subsets are unnamed, so a hand-built palette needs no unname() c(ekio_pal("blue")["700"], ekio_pal("orange")["500"])
Professional scatter plot with smart aesthetic detection.
ekio_scatterplot( data, x, y, color = NULL, size = NULL, palette = NULL, add_zero = FALSE, add_smooth = FALSE, smooth_method = "lm", point_size = 2.5, point_alpha = 0.8, title = NULL, subtitle = NULL, caption = NULL, ... )ekio_scatterplot( data, x, y, color = NULL, size = NULL, palette = NULL, add_zero = FALSE, add_smooth = FALSE, smooth_method = "lm", point_size = 2.5, point_alpha = 0.8, title = NULL, subtitle = NULL, caption = NULL, ... )
data |
A data frame |
x |
X-axis variable (supports data-masking) |
y |
Y-axis variable (supports data-masking) |
color |
Color aesthetic. A color string or a variable. A continuous variable warns and uses a sequential ramp. |
size |
Size aesthetic (optional variable) |
palette |
Character. Palette name for variable mappings. |
add_zero |
Logical. Add horizontal line at y=0 (default: FALSE) |
add_smooth |
Logical. Add smooth trend line (default: FALSE) |
smooth_method |
Smoothing method: "lm", "gam", "loess" (default: "lm") |
point_size |
Base point size (default: 2.5) |
point_alpha |
Point transparency (default: 0.8) |
title, subtitle, caption
|
Plot labels. NULL (default) draws none. |
... |
Additional arguments passed to |
ggplot2 object
ekio_scatterplot(mtcars, wt, mpg) ekio_scatterplot(mtcars, wt, mpg, color = factor(cyl))ekio_scatterplot(mtcars, wt, mpg) ekio_scatterplot(mtcars, wt, mpg, color = factor(cyl))
Resolve an EKIO brand surface name to a hex code. ekio_surface() takes the
same vocabulary as theme_ekio(background = ): "offwhite" (#FBFBF6),
"white" (#FFFFFF) and "cold" (#F6F7F8). A hex code such as
"#F0EAD6" is passed through unchanged, and "transparent" returns
NA_character_ so ggplot2::element_rect() draws nothing.
ekio_surface(surface = "offwhite", arg = "surface", call = current_env())ekio_surface(surface = "offwhite", arg = "surface", call = current_env())
surface |
Character. A brand surface name or a hex code. |
arg, call
|
The argument name and the calling environment used to build
error messages. See |
A single hex code, or NA_character_ for "transparent".
ekio_surface("cold") ekio_surface("#F0EAD6")ekio_surface("cold") ekio_surface("#F0EAD6")
Returns the text color (dark or light) with the higher WCAG contrast
ratio against each background color. Useful for labels placed on colored
fills, e.g. in ggplot2::geom_text().
ekio_text_on(background, dark = "black", light = "white")ekio_text_on(background, dark = "black", light = "white")
background |
Character. Background color(s) as hex codes or R color names. |
dark |
Character. Dark text color candidate (default: |
light |
Character. Light text color candidate (default: |
Character vector of text colors, one per background. Names of
background are preserved.
ekio_contrast() for the underlying contrast ratios
ekio_text_on(ekio_pal("blue")["700"]) ekio_text_on(ekio_pal("blue")) ekio_text_on(ekio_pal("full"), dark = ekio_pal("gray")["900"])ekio_text_on(ekio_pal("blue")["700"]) ekio_text_on(ekio_pal("blue")) ekio_text_on(ekio_pal("full"), dark = ekio_pal("gray")["900"])
Returns names of all available palettes, optionally filtered by type.
list_ekio_palettes(type = "all")list_ekio_palettes(type = "all")
type |
Character. Type of palettes to list: "accent", "brand", "academy", "categorical", "scientific", "sequential", "diverging", or "all" (default). |
Character vector of palette names, or named list if type = "all".
list_ekio_palettes() list_ekio_palettes("categorical")list_ekio_palettes() list_ekio_palettes("categorical")
Apply sequential, diverging or academy palettes to continuous/numeric data.
scale_color_ekio_c(palette = "blue", reverse = FALSE, ...) scale_colour_ekio_c(palette = "blue", reverse = FALSE, ...) scale_fill_ekio_c(palette = "blue", reverse = FALSE, ...)scale_color_ekio_c(palette = "blue", reverse = FALSE, ...) scale_colour_ekio_c(palette = "blue", reverse = FALSE, ...) scale_fill_ekio_c(palette = "blue", reverse = FALSE, ...)
palette |
Character. Palette name (default: "blue").
See |
reverse |
Logical. If TRUE, reverses the color order. |
... |
Additional arguments passed to |
A ggplot2 scale object
scale_fill_ekio_c(), list_ekio_palettes()
library(ggplot2) ggplot(mtcars, aes(wt, mpg, color = hp)) + geom_point(size = 3) + scale_color_ekio_c() ggplot(mtcars, aes(wt, mpg, color = hp)) + geom_point(size = 3) + scale_color_ekio_c("stone")library(ggplot2) ggplot(mtcars, aes(wt, mpg, color = hp)) + geom_point(size = 3) + scale_color_ekio_c() ggplot(mtcars, aes(wt, mpg, color = hp)) + geom_point(size = 3) + scale_color_ekio_c("stone")
Apply qualitative palettes to discrete/categorical data.
scale_color_ekio_d(palette = "full", reverse = FALSE, ...) scale_colour_ekio_d(palette = "full", reverse = FALSE, ...) scale_fill_ekio_d(palette = "full", reverse = FALSE, ...)scale_color_ekio_d(palette = "full", reverse = FALSE, ...) scale_colour_ekio_d(palette = "full", reverse = FALSE, ...) scale_fill_ekio_d(palette = "full", reverse = FALSE, ...)
palette |
Character. Palette name (default: "full").
See |
reverse |
Logical. If TRUE, reverses the palette order. |
... |
Additional arguments passed to |
A ggplot2 scale object
ekio_pal(), scale_fill_ekio_d()
library(ggplot2) ggplot(mtcars, aes(wt, mpg, color = factor(cyl))) + geom_point(size = 3) + scale_color_ekio_d()library(ggplot2) ggplot(mtcars, aes(wt, mpg, color = factor(cyl))) + geom_point(size = 3) + scale_color_ekio_d()
A minimal, professional theme for EKIO visualizations built on
ggplot2::theme_minimal().
theme_ekio( base_size = 11, font_title = "Lora", font_text = "Lato", title_align = "plot", grid = "y", ticks = "x", background = "offwhite", ... )theme_ekio( base_size = 11, font_title = "Lora", font_text = "Lato", title_align = "plot", grid = "y", ticks = "x", background = "offwhite", ... )
base_size |
Numeric. Base font size in points (default: 11). |
font_title |
Character. Font family passed only to the chart title. Defaults to 'Lora'. |
font_text |
Character. Font family passed to all textual elements except the title. Defaults to 'Lato'. |
title_align |
Argument passed to |
grid |
Character. Which major grid lines to show: |
ticks |
Character. Which axis ticks and lines to show: |
background |
Character. Plot and panel background: |
... |
Additional arguments passed to |
A ggplot2 theme object
ggplot2::ggplot(mtcars, ggplot2::aes(wt, mpg)) + ggplot2::geom_point() + theme_ekio(font_title = "serif", font_text = "sans")ggplot2::ggplot(mtcars, ggplot2::aes(wt, mpg)) + ggplot2::geom_point() + theme_ekio(font_title = "serif", font_text = "sans")
Returns the plot-level parts of theme_ekio() for use with
patchwork::plot_annotation(theme = ). The theme colors the outer canvas
and styles titles without changing the panels or axes of child plots.
theme_patchwork(background = "offwhite", ...)theme_patchwork(background = "offwhite", ...)
background |
Character. Background surface accepted by |
... |
Additional arguments passed to |
A partial ggplot2 theme.
theme_patchwork(background = "offwhite")theme_patchwork(background = "offwhite")