| Type: | Package |
| Title: | EKIO Visual Identity for 'ggplot2' |
| Version: | 1.1.0 |
| 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. |
| URL: | https://viniciusoike.github.io/ekioplot/, https://github.com/viniciusoike/ekioplot |
| License: | MIT + file LICENSE |
| Copyright: | file inst/COPYRIGHTS |
| Depends: | R (≥ 4.1.0) |
| Encoding: | UTF-8 |
| LazyData: | true |
| RoxygenNote: | 7.3.3 |
| Imports: | cli, ggplot2 (≥ 4.0.0), grDevices, rlang, systemfonts |
| Suggests: | dplyr, knitr, rmarkdown, testthat (≥ 3.0.0), tibble, yaml |
| VignetteBuilder: | knitr |
| Config/testthat/edition: | 3 |
| Config/Needs/website: | reactable |
| NeedsCompilation: | no |
| Packaged: | 2026-08-25 17:53:34 UTC; viniciusreginatto |
| Author: | Vinicius Oike |
| Maintainer: | Vinicius Oike <viniciusor@ekio.io> |
| Repository: | CRAN |
| Date/Publication: | 2026-09-08 12:30:30 UTC |
Brazilian municipal crop production, 2022
Description
Municipal production of soybeans, corn and sugarcane from IBGE's Municipal Agricultural Production Survey (PAM).
Usage
brazil_agriculture
Format
A tibble with 16,689 rows and 12 variables:
- code_muni
IBGE municipality code (numeric)
- name_muni
Municipality name (character)
- name_state
State name (character)
- name_region
Brazilian region (character)
- crop
Crop name (character)
- production_tonnes
Production volume, tonnes (numeric)
- area_harvested_ha
Harvested area, hectares (numeric)
- yield
Productivity, tonnes per hectare (numeric)
- crop_type
Crop cycle (character)
- crop_category
Crop category (character)
- crop_importance
Economic importance (character)
- production_scale
Production-scale category (integer)
Source
IBGE, Table 1612: Municipal Agricultural Production (PAM). https://sidra.ibge.gov.br/tabela/1612
References
IBGE. (2023). Produção Agrícola Municipal - PAM 2022.
Brazilian state crop production, 1974–2023
Description
Annual production of seven major crops by Brazilian state from IBGE's Municipal Agricultural Production Survey (PAM).
Usage
brazil_agriculture_states
Format
A tibble with 9,450 rows and 8 variables:
- code_state
IBGE state code (numeric)
- name_state
State name (character)
- year
Observation year (numeric)
- crop
Crop name (character)
- production_tonnes
Production volume, tonnes (numeric)
- area_harvested_ha
Harvested area, hectares (numeric)
- yield_kg_per_ha
Productivity, kilograms per hectare (numeric)
- production_value_brl_k
Production value, thousands of Brazilian reais (numeric)
Details
Crops are beans, corn, cotton, rice, soybeans, sugarcane and wheat.
Source
IBGE, Table 1612: Municipal Agricultural Production (PAM). https://sidra.ibge.gov.br/tabela/1612
References
IBGE. (2023). Produção Agrícola Municipal - PAM 2022.
Brazilian municipal GDP, 2021
Description
Municipal GDP for all 5,570 Brazilian municipalities, at current prices.
Usage
brazil_gdp
Format
A tibble with 5,570 rows and 7 variables:
- code_muni
IBGE municipality code (numeric)
- name_muni
Municipality name (character)
- code_state
IBGE state code (numeric)
- name_state
State name (character)
- year
Observation year (numeric)
- gdp_brl_k
GDP, thousands of Brazilian reais (numeric)
- gdp_brl_m
GDP, millions of Brazilian reais (numeric)
Source
IBGE, Table 5938: GDP and other aggregates by municipality. https://sidra.ibge.gov.br/tabela/5938
References
IBGE. (2023). Produto Interno Bruto dos Municípios - 2021.
Brazilian municipal population, 2025
Description
Population estimates for Brazil's 338 municipalities with more than 100,000 inhabitants.
Usage
brazil_population
Format
A tibble with 338 rows and 5 variables:
- rank
Population rank (numeric)
- name_muni
Municipality name (character)
- abbrev_state
State abbreviation (character)
- population
2025 population estimate (numeric)
- category
Ordered city-size category (factor)
Details
Categories are Metropolis (1M+), Large city (500K–1M), Medium city (200K–500K) and Small city (100K–200K).
Source
IBGE, Table 6579: Municipal population estimates. https://sidra.ibge.gov.br/tabela/6579
EKIO Area Plot
Description
Professional area plot with smart aesthetic detection. Supports stacked and filled (proportional) area charts.
Usage
ekio_areaplot(
data,
x,
y,
fill = NULL,
palette = NULL,
position = "stack",
alpha = 1,
title = NULL,
subtitle = NULL,
caption = NULL,
...
)
Arguments
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 |
Value
ggplot2 object
Examples
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 Bar Plot
Description
Professional bar plot with smart aesthetic detection.
Usage
ekio_barplot(
data,
x,
y,
fill = NULL,
palette = NULL,
horizontal = FALSE,
bar_width = 0.8,
title = NULL,
subtitle = NULL,
caption = NULL,
...
)
Arguments
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 |
Value
ggplot2 object
Examples
cyl_counts <- as.data.frame(table(cyl = mtcars$cyl))
names(cyl_counts)[2] <- "n"
ekio_barplot(cyl_counts, cyl, n)
WCAG Contrast Ratio Between Two Colors
Description
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.
Usage
ekio_contrast(color, background = "white")
Arguments
color |
Character. Foreground color(s) as hex codes or R color names. |
background |
Character. Background color(s) (default: |
Value
Numeric vector of contrast ratios between 1 and 21
See Also
ekio_text_on() to pick a readable text color for a background
Examples
ekio_contrast("black", "white")
ekio_contrast(ekio_pal("blue")["700"])
ekio_contrast("white", ekio_pal("blue"))
EKIO Histogram
Description
Professional histogram with smart aesthetic detection.
Usage
ekio_histogram(
data,
x,
fill = NULL,
palette = NULL,
bins = "sturges",
binwidth = NULL,
border_color = "white",
title = NULL,
subtitle = NULL,
caption = NULL,
...
)
Arguments
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 |
Value
ggplot2 object
Examples
ekio_histogram(mtcars, mpg)
ekio_histogram(mtcars, mpg, fill = "steelblue")
ekio_histogram(mtcars, mpg, fill = factor(cyl), palette = "full")
EKIO Line Plot
Description
Professional line plot with smart aesthetic detection.
Usage
ekio_lineplot(
data,
x,
y,
color = NULL,
palette = NULL,
add_zero = FALSE,
line_width = 0.8,
title = NULL,
subtitle = NULL,
caption = NULL,
...
)
Arguments
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 |
Value
ggplot2 object
Examples
ekio_lineplot(ggplot2::economics, date, unemploy)
Get Color Palette
Description
Returns colors for data visualization. Includes EKIO brand scales, accent and categorical palettes, and standard scientific palettes. When printed interactively, displays the palette as a colored swatch with hex labels.
Usage
ekio_pal(palette = "full", n = NULL, reverse = FALSE)
Arguments
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. |
Details
Brand scales ("blue", "gray", "stone", "teal", "green",
"orange", "red") 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.
"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.
Value
Object of class ekio_palette (a character vector of hex
codes). Printing displays a visual swatch. Use as.character() to
strip the class.
Source
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.
Examples
ekio_pal("full")
ekio_pal("full", n = 4)
ekio_pal("full", reverse = TRUE)
ekio_pal("accent_blue", n = 5)
ekio_pal("okabe_ito")
# 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"]
EKIO Scatter Plot
Description
Professional scatter plot with smart aesthetic detection.
Usage
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,
...
)
Arguments
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 |
Value
ggplot2 object
Examples
ekio_scatterplot(mtcars, wt, mpg)
ekio_scatterplot(mtcars, wt, mpg, color = factor(cyl))
Pick a Readable Text Color for a Background
Description
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().
Usage
ekio_text_on(background, dark = "black", light = "white")
Arguments
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: |
Value
Character vector of text colors, one per background. Names of
background are preserved.
See Also
ekio_contrast() for the underlying contrast ratios
Examples
ekio_text_on(ekio_pal("blue")["700"])
ekio_text_on(ekio_pal("blue"))
ekio_text_on(ekio_pal("full"), dark = ekio_pal("gray")["900"])
List Available Palettes
Description
Returns names of all available palettes, optionally filtered by type.
Usage
list_ekio_palettes(type = "all")
Arguments
type |
Character. Type of palettes to list: "accent", "categorical", "scientific", "sequential", "diverging", or "all" (default). |
Value
Character vector of palette names, or named list if type = "all".
Examples
list_ekio_palettes()
list_ekio_palettes("categorical")
Continuous Color Scale
Description
Apply sequential or diverging palettes to continuous/numeric data.
Usage
scale_color_ekio_c(palette = "blue", reverse = FALSE, ...)
scale_colour_ekio_c(palette = "blue", reverse = FALSE, ...)
scale_fill_ekio_c(palette = "blue", reverse = FALSE, ...)
Arguments
palette |
Character. Palette name (default: "blue").
See |
reverse |
Logical. If TRUE, reverses the color order. |
... |
Additional arguments passed to |
Value
A ggplot2 scale object
See Also
scale_fill_ekio_c(), list_ekio_palettes()
Examples
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")
Discrete Color Scale
Description
Apply qualitative palettes to discrete/categorical data.
Usage
scale_color_ekio_d(palette = "full", reverse = FALSE, ...)
scale_colour_ekio_d(palette = "full", reverse = FALSE, ...)
scale_fill_ekio_d(palette = "full", reverse = FALSE, ...)
Arguments
palette |
Character. Palette name (default: "full").
See |
reverse |
Logical. If TRUE, reverses the palette order. |
... |
Additional arguments passed to |
Value
A ggplot2 scale object
See Also
ekio_pal(), scale_fill_ekio_d()
Examples
library(ggplot2)
ggplot(mtcars, aes(wt, mpg, color = factor(cyl))) +
geom_point(size = 3) +
scale_color_ekio_d()
Apply EKIO Theme to ggplot2 Plots
Description
A minimal, professional theme for EKIO visualizations built on
ggplot2::theme_minimal().
Usage
theme_ekio(
base_size = 11,
font_title = "Lora",
font_text = "Lato",
title_align = "plot",
grid = "y",
ticks = "x",
background = "offwhite",
...
)
Arguments
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 |
Value
A ggplot2 theme object
Examples
ggplot2::ggplot(mtcars, ggplot2::aes(wt, mpg)) +
ggplot2::geom_point() +
theme_ekio(font_title = "serif", font_text = "sans")