Package 'ekioplot'

Title: EKIO Visual Identity System for R Data Visualization
Description: A ggplot2 implementation of EKIO's visual identity for data visualization. Professional themes, curated color palettes, and scale functions for ggplot2 and gt tables. Includes high-level recipe functions for common chart types.
Authors: Vinicius Oike [aut, cre, cph] (ORCID: <https://orcid.org/0009-0005-8015-9189>)
Maintainer: Vinicius Oike <[email protected]>
License: MIT + file LICENSE
Version: 0.4.0
Built: 2026-06-19 23:07:39 UTC
Source: https://github.com/viniciusoike/ekioplot

Help Index


Brazilian Municipal Agricultural Production (2022)

Description

A comprehensive dataset containing agricultural production data for Brazil's three major crops by municipality, based on IBGE's Municipal Agricultural Production survey (PAM - Produção Agrícola Municipal).

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

Region name in Portuguese (character)

crop

Crop name in English (character)

production_tonnes

Production quantity in tonnes (numeric)

area_harvested_ha

Area harvested in hectares (numeric)

yield

Calculated productivity in tonnes per hectare (numeric)

crop_type

Crop cultivation type: annual, semi-perennial (character)

crop_category

Crop category: grains, industrial (character)

crop_importance

Economic importance: major (character)

production_scale

Production scale category (integer)

Details

The dataset covers Brazil's three major crops by municipality in 2022: soybeans, corn, and sugarcane. This represents municipal-level agricultural production data for analysis of regional agricultural patterns.

Crops included:

  • Soybeans: Brazil's top agricultural export (annual grain crop)

  • Corn: Major grain crop for domestic and export markets (annual)

  • Sugarcane: Industrial crop for sugar and ethanol (semi-perennial)

Geographic coverage: All Brazilian municipalities with production data for these crops across all regions.

Source

IBGE - Instituto Brasileiro de Geografia e Estatística Table 1612: Area, production, yield and value of agricultural production (PAM - Produção Agrícola Municipal) https://www.ibge.gov.br/

References

IBGE. (2023). Produção Agrícola Municipal - PAM 2022. Rio de Janeiro: IBGE.

Examples

## Not run: 
# Load the dataset
data(brazil_agriculture)

# View top soybean producing municipalities
brazil_agriculture |>
  filter(crop == "soybeans") |>
  slice_max(production_tonnes, n = 10)

# Check available crops
unique(brazil_agriculture$crop)

# View structure
str(brazil_agriculture)

## End(Not run)

Brazilian State-Level Agricultural Production Time Series (1974-2023)

Description

A time series dataset containing agricultural production data for Brazil's major crops by state, based on 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

Year of observation (1974-2023, numeric)

crop

Crop name in English (character)

production_tonnes

Production quantity in tonnes (numeric)

area_harvested_ha

Area harvested in hectares (numeric)

yield_kg_per_ha

Productivity in kg per hectare (numeric)

production_value_brl_k

Production value in thousands of BRL (numeric)

Details

This dataset provides state-level time series for Brazil's seven most important crops from 1974 to 2023, enabling analysis of long-term agricultural trends and regional specialization patterns.

Crops included:

  • Soybeans: Brazil's top agricultural export

  • Corn: Major grain crop for domestic and export markets

  • Sugarcane: Industrial crop for sugar and ethanol

  • Cotton: Key fiber crop and export commodity

  • Rice: Important food security crop

  • Wheat: Food grain crop, mainly in southern states

  • Beans: Traditional protein source and food security crop

Time coverage: Nearly 50 years of data (1974-2023) providing comprehensive historical perspective on Brazilian agricultural development.

Source

IBGE - Instituto Brasileiro de Geografia e Estatística Table 1612: Area, production, yield and value of agricultural production (PAM - Produção Agrícola Municipal) https://www.ibge.gov.br/

References

IBGE. (2023). Produção Agrícola Municipal - PAM 2022. Rio de Janeiro: IBGE.

Examples

## Not run: 
# Load the dataset
data(brazil_agriculture_states)

# Soybean production trends by top states (recent years)
brazil_agriculture_states |>
  filter(crop == "soybeans", year >= 2010, !is.na(production_tonnes)) |>
  slice_max(production_tonnes, n = 50) |>
  ggplot(aes(year, production_tonnes, color = name_state)) +
  geom_line()

# View structure
str(brazil_agriculture_states)

## End(Not run)

Brazilian Municipal GDP and Economic Structure (2021)

Description

A dataset containing municipal GDP data for all Brazilian municipalities based on IBGE's Municipal National Accounts (Contas Nacionais Municipais).

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

Year of observation (2021, numeric)

gdp_brl_k

GDP in thousands of Brazilian reais (numeric)

gdp_brl_m

GDP in millions of Brazilian reais (numeric)

Details

The dataset includes GDP data for all 5,570 Brazilian municipalities for 2021, the most recent year available in IBGE's Municipal National Accounts. GDP values are provided in both thousands (gdp_brl_k) and millions (gdp_brl_m) of Brazilian reais at current prices.

Source

IBGE - Instituto Brasileiro de Geografia e Estatística Table 5938: GDP and other aggregates by municipality (Contas Nacionais Municipais) https://www.ibge.gov.br/

References

IBGE. (2023). Produto Interno Bruto dos Municípios - 2021. Rio de Janeiro: IBGE.

Examples

## Not run: 
# Load the dataset
data(brazil_gdp)

# Top 10 municipalities by GDP in 2021
brazil_gdp |>
  slice_max(gdp_brl_m, n = 10)

# View structure
str(brazil_gdp)

## End(Not run)

Brazilian Municipal Population Data (2025)

Description

A dataset containing population data for Brazilian municipalities with over 100,000 inhabitants, based on IBGE population estimates for 2025.

Usage

brazil_population

Format

A tibble with 338 rows and 5 variables:

rank

Population ranking among all municipalities (numeric)

name_muni

Municipality name (character)

abbrev_state

State abbreviation (character)

population

Total population in 2025 (numeric)

category

City size category based on population (ordered factor)

Details

The dataset focuses on Brazil's 338 largest municipalities (population > 100,000) and provides population ranking and size classification for 2025.

City size categories:

  • Metropolis (1M+): 1 million+ inhabitants

  • Large city (500K-1M): 500,000 to 1 million inhabitants

  • Medium city (200K-500K): 200,000 to 500,000 inhabitants

  • Small city (100K-200K): 100,000 to 200,000 inhabitants

Source

IBGE - Instituto Brasileiro de Geografia e Estatística Table 6579: Municipal population estimates https://www.ibge.gov.br/

Examples

## Not run: 
# Load the dataset
data(brazil_population)

# View the largest cities
head(brazil_population)

# Count cities by category
table(brazil_population$category)

## End(Not run)

EKIO Named Accent Colors

Description

Individual accent colors for quick access.

Usage

ekio_accent

Format

Named character vector with 8 accent colors

Examples

ekio_accent["blue"]    # Primary blue
ekio_accent["orange"]  # Contrast accent

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 = 0.8,
  add_zero = TRUE,
  ...
)

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 variable name.

palette

Character. Palette name for variable mappings.

position

Character. Stacking method: "stack" (default) or "fill" for proportional areas.

alpha

Numeric. Fill transparency (default: 0.8).

add_zero

Logical. Add horizontal line at y=0 (default: TRUE).

...

Additional arguments passed to ggplot2::geom_area()

Value

ggplot2 object

Examples

ekio_areaplot(ggplot2::economics, date, unemploy)

# Stacked area with groups
data(fuels)
world_fuels <- fuels[fuels$entity == "World" & fuels$year >= 1950, ]
ekio_areaplot(world_fuels, year, consumption_gwh, fill = fuel)

EKIO Bar Plot

Description

Professional bar plot with smart aesthetic detection.

Usage

ekio_barplot(
  data,
  x,
  y,
  fill = NULL,
  palette = NULL,
  add_zero = TRUE,
  horizontal = FALSE,
  bar_width = 0.8,
  ...
)

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 variable name.

palette

Character. Palette name for variable mappings.

add_zero

Logical. Add horizontal line at y=0 (default: TRUE)

horizontal

Logical. Create horizontal bar plot (default: FALSE)

bar_width

Bar width (default: 0.8)

...

Additional arguments passed to ggplot2::geom_col()

Value

ggplot2 object

Examples

cyl_counts <- as.data.frame(table(cyl = mtcars$cyl))
names(cyl_counts)[2] <- "n"
ekio_barplot(cyl_counts, cyl, n)

EKIO Primary Blue Scale

Description

Brand identity color scale from light to dark.

Usage

ekio_blue

Format

Named character vector with 10 shades (50-900)

Examples

ekio_blue["700"]  # Primary brand blue
ekio_blue["200"]  # Light blue for backgrounds

EKIO Neutral Gray Scale

Description

Neutral grays for text, backgrounds, borders, and grids.

Usage

ekio_gray

Format

Named character vector with 10 shades (50-900)

Examples

ekio_gray["900"]  # Darkest text
ekio_gray["300"]  # Grid lines

EKIO Histogram

Description

Professional histogram with smart aesthetic detection.

Usage

ekio_histogram(
  data,
  x,
  fill = NULL,
  palette = NULL,
  bins = "sturges",
  binwidth = NULL,
  add_zero = TRUE,
  border_color = "white",
  ...
)

Arguments

data

A data frame

x

Variable to plot (supports data-masking)

fill

Fill aesthetic. A color string or variable name. NULL uses EKIO blue.

palette

Character. Palette name for variable mappings.

bins

Binning method: "sturges", "FD", "scott", or numeric.

binwidth

Width of bins (overrides bins if specified)

add_zero

Logical. Add horizontal line at y=0 (default: TRUE)

border_color

Color for histogram outline (default: "white")

...

Additional arguments passed to ggplot2::geom_histogram()

Value

ggplot2 object

Examples

ekio_histogram(mtcars, mpg)
ekio_histogram(mtcars, mpg, fill = "steelblue")
ekio_histogram(mtcars, mpg, fill = factor(cyl), palette = "cool")

EKIO Line Plot

Description

Professional line plot with smart aesthetic detection.

Usage

ekio_lineplot(
  data,
  x,
  y,
  color = NULL,
  palette = NULL,
  add_zero = TRUE,
  line_width = 0.8,
  ...
)

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 variable name.

palette

Character. Palette name for variable mappings.

add_zero

Logical. Add horizontal line at y=0 (default: TRUE)

line_width

Line thickness (default: 0.8)

...

Additional arguments passed to ggplot2::geom_line()

Value

ggplot2 object

Examples

ekio_lineplot(ggplot2::economics, date, unemploy)

EKIO Orange Scale

Description

Accent color for highlights, warnings, and contrast against blue.

Usage

ekio_orange

Format

Named character vector with 10 shades (50-900)

Examples

ekio_orange["600"]  # Primary orange accent
ekio_orange["300"]  # Soft orange for fills

Get Color Palette

Description

Returns colors for data visualization. Includes EKIO brand palettes, curated small-group variants, and standard scientific palettes.

Usage

ekio_pal(palette = "contrast", n = NULL, reverse = FALSE)

Arguments

palette

Character. Name of the palette. See list_ekio_palettes() for all available options.

n

Integer or NULL. Number of colors to return. If NULL, returns all.

reverse

Logical. If TRUE, reverses the palette order.

Value

Character vector of hex color codes

Examples

ekio_pal("contrast")
ekio_pal("contrast", n = 4)
ekio_pal("binary", reverse = TRUE)
ekio_pal("okabe_ito")

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 = TRUE,
  add_smooth = FALSE,
  smooth_method = "lm",
  point_size = 2.5,
  point_alpha = 0.8,
  ...
)

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 variable name.

size

Size aesthetic (optional variable)

palette

Character. Palette name for variable mappings.

add_zero

Logical. Add horizontal line at y=0 (default: TRUE)

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)

...

Additional arguments passed to ggplot2::geom_point()

Value

ggplot2 object

Examples

ekio_scatterplot(mtcars, wt, mpg)
ekio_scatterplot(mtcars, wt, mpg, color = factor(cyl))

EKIO Teal Scale

Description

Secondary brand color for complementary use.

Usage

ekio_teal

Format

Named character vector with 10 shades (50-900)

Examples

ekio_teal["700"]  # Strong teal
ekio_teal["300"]  # Light teal accent

Global Fuel Consumption by Source

Description

Historical primary energy consumption data by fuel type and entity, spanning from 1800 to the present.

Usage

fuels

Format

A tibble with 4 variables:

entity

Country, region, or aggregated group name (character)

year

Year of observation (numeric)

fuel

Fuel type: "gas", "oil", or "coal" (character)

consumption_gwh

Primary energy consumption in gigawatt-hours (numeric)

Source

Our World in Data — Energy https://ourworldindata.org/energy

Examples

## Not run: 
data(fuels)

# Global consumption over time by fuel type
fuels |>
  dplyr::filter(entity == "World") |>
  ggplot2::ggplot(ggplot2::aes(year, consumption_gwh, color = fuel)) +
  ggplot2::geom_line()

## End(Not run)

Apply EKIO Theme to GT Tables

Description

Professional EKIO branding and styling for gt table objects.

Usage

gt_theme_ekio(
  data,
  table_width = "100%",
  font_size = 14,
  stripe = TRUE,
  add_footer = TRUE
)

Arguments

data

A gt table object

table_width

Character. Width of the table (default: "100%")

font_size

Numeric. Base font size in pixels (default: 14)

stripe

Logical. Apply alternating row striping (default: TRUE)

add_footer

Logical. Add automatic EKIO footer (default: TRUE)

Value

A styled gt table object

Examples

## Not run: 
library(gt)
head(mtcars, 10) |>
  gt() |>
  gt_theme_ekio()

## End(Not run)

IPS Brasil 2025 - Social Progress Index for Brazilian Municipalities

Description

A dataset containing the Social Progress Index rankings for the top 25 most populated Brazilian municipalities in 2025. The IPS Brasil is a comprehensive index that measures social and environmental progress across all 5,570 Brazilian municipalities using 57 indicators.

Usage

ips_brasil

Format

A data frame with 200 rows (25 municipalities x 8 measures) and 8 variables:

codigo_ibge

IBGE municipality code (numeric)

municipio

Municipality name (character)

uf

State abbreviation (character)

populacao_2022

Population in 2022 (numeric)

measure

Indicator measured, one of 8 key social progress indicators (factor)

rank

Ranking position among the 25 municipalities for each measure (1-25, numeric)

highlight

Municipality name if it's one of the 7 highlighted cities, empty string otherwise (character)

is_highlight

Factor indicating if municipality is highlighted (0 or 1)

rank_labels

Formatted rank labels showing only positions 1, 5, 10, 15, 20, 25 with ordinal suffix (character)

Details

The dataset focuses on the 25 most populated Brazilian municipalities and includes rankings across 8 key social progress indicators:

Indicators included:

  • Social Progress Index: Overall composite score

  • GDP per capita: Economic indicator (2021 data)

  • Water and Sanitation: Access to basic services

  • Housing Conditions: Quality of housing infrastructure

  • Safety: Personal security measures

  • Healthcare and Wellbeing: Health system performance

  • Avg. ENEM scores: Educational outcomes (national exam)

  • Share College Educ.: Percentage of population with higher education

Highlighted municipalities (7 cities with special focus): The dataset highlights 7 specific municipalities for comparison purposes: Sao Paulo (SP), Brasilia (DF), Rio de Janeiro (RJ), Belem (PA), Porto Alegre (RS), Fortaleza (CE), and Recife (PE).

Data transformation: Rankings are calculated where rank 1 = best performance and rank 25 = worst performance among the top 25 most populated cities. The data is in long format with one row per municipality-indicator combination.

Source

IPS Brasil 2025 - Indice de Progresso Social Brasil https://ipsbrasil.org.br/pt

The IPS Brasil is developed by Instituto Imazon and follows the methodology of the Social Progress Imperative, using 57 indicators across three dimensions: Basic Human Needs, Foundations of Wellbeing, and Opportunity.

References

Imazon. (2025). Indice de Progresso Social Brasil 2025. https://imazon.org.br/indice_de_progresso_social_brasil_2025/

Examples

## Not run: 
# Load the dataset
data(ips_brasil)

# View structure
str(ips_brasil)

## End(Not run)

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: "categorical", "small_group", "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")
list_ekio_palettes("diverging")

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 list_ekio_palettes("sequential") and list_ekio_palettes("diverging") for options.

reverse

Logical. If TRUE, reverses the color order.

...

Additional arguments passed to ggplot2::scale_color_gradientn()

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("purple")

Discrete Color Scale

Description

Apply qualitative palettes to discrete/categorical data.

Usage

scale_color_ekio_d(palette = "contrast", reverse = FALSE, ...)

scale_colour_ekio_d(palette = "contrast", reverse = FALSE, ...)

scale_fill_ekio_d(palette = "contrast", reverse = FALSE, ...)

Arguments

palette

Character. Palette name (default: "contrast"). See ekio_pal() for options.

reverse

Logical. If TRUE, reverses the palette order.

...

Additional arguments passed to ggplot2::discrete_scale()

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()

Show All Palettes

Description

Lists all available palettes organized by type.

Usage

show_all_ekio_palettes()

Value

NULL (invisibly). Prints palette information to console.

Examples

show_all_ekio_palettes()

Display a Palette

Description

Visualizes a color palette as a horizontal bar chart with hex labels.

Usage

show_ekio_palette(palette, n = NULL, labels = TRUE)

Arguments

palette

Character or vector. Either a palette name or a vector of hex colors.

n

Integer. Number of colors (used for interpolation on sequential palettes).

labels

Logical. Show hex codes as labels (default: TRUE).

Value

A ggplot2 object (invisibly)

Examples

show_ekio_palette("contrast")
show_ekio_palette(c("#1E3A5F", "#DD6B20", "#2C7A7B"))

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, base_family = "", grid = "y")

Arguments

base_size

Numeric. Base font size in points (default: 11)

base_family

Character. Font family. Defaults to the platform-appropriate EKIO font via .get_ekio_font().

grid

Character. Which major grid lines to show: "y" (default), "x", "xy", or "none".

Value

A ggplot2 theme object


Apply EKIO Map Theme to ggplot2 Plots

Description

A variant of theme_ekio() with axes and grid removed, suited for choropleth and spatial maps.

Usage

theme_ekio_map(base_size = 11, base_family = "")

Arguments

base_size

Numeric. Base font size in points (default: 11)

base_family

Character. Font family. Defaults to the platform-appropriate EKIO font via .get_ekio_font().

Value

A ggplot2 theme object