A ggplot2 theme built on Insper's brand colors and typography, with arguments for grid lines, borders, and title alignment.
Usage
theme_insper(
base_size = 12,
font_title = "Georgia",
font_text = "Inter",
grid = TRUE,
border = "none",
align = "panel",
...
)Arguments
- base_size
Numeric. Base font size for all text elements in points. Default is 12. All other text sizes are calculated relative to this value.
- font_title
Character. Font family to use for plot titles and subtitles. Default is "Georgia" (serif, the documented substitute for Insper's primary GT Ultra). The theme automatically detects font availability and falls back to the system "serif" family if Georgia is unavailable.
- font_text
Character. Font family to use for all other text elements (axis labels, legend text, etc.). Default is "Inter" (sans-serif, from Insper's official template). Falls back to "Arial" then "sans" if unavailable.
- grid
Logical. Whether to display major grid lines. If TRUE, shows light gray grid lines. If FALSE, removes all grid lines. Minor grid lines are always removed. Default is TRUE.
- border
Character. Type of plot border to display. Must be one of:
"none" - No border or axis lines (default)
"half" - Shows axis lines with ticks but no full border
"closed" - Shows a complete rectangular border around the plot area
- align
Character. Alignment of title and caption. Must be one of:
"panel" - Align to the plot panel area (default)
"plot" - Align to the entire plot area including margins
- ...
Additional arguments passed to
theme_minimal().
Details
The theme sets a white plot background, places a horizontal legend at the top with a bold title, removes minor grid lines, and draws remaining elements in Insper brand grays.
**Fonts:**
Titles use Georgia and body text uses Inter, following Insper's official template. Inter is bundled with the package and registered automatically on load. Georgia is a system font, and the documented substitute for Insper's primary GT Ultra. Where either is unavailable, the theme falls back to the system "serif" and "sans" families.
See also
Other themes:
theme_insper_doc()
Examples
if (FALSE) { # has_insper_fonts()
library(ggplot2)
# Default
ggplot(mtcars, aes(x = wt, y = mpg)) +
geom_point() +
theme_insper()
# Minimal — no grid, clean background
ggplot(mtcars, aes(x = wt, y = mpg)) +
geom_point() +
theme_insper(grid = FALSE)
# Presentation — larger text for slides
ggplot(mtcars, aes(x = wt, y = mpg)) +
geom_point() +
theme_insper(base_size = 16, grid = FALSE)
# Print / PDF — closed border, smaller text
ggplot(mtcars, aes(x = wt, y = mpg)) +
geom_point() +
theme_insper(base_size = 11, border = "closed")
}
