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 in points. Default is 12. All other text sizes are relative to this value.
- font_title
Character. Font family for the plot title. Default is
"Georgia", the substitute for Insper's proprietary GT Ultra. Falls back to the system"serif"family if Georgia is unavailable.- font_text
Character. Font family for all other text (subtitle, axis labels, legend, caption). Default is
"Inter", which ships with the package. Falls back to"Arial", then to the system"sans"family.- grid
Logical. If
TRUE(default), draws light gray major grid lines. IfFALSE, removes all grid lines. Minor grid lines are always removed.- border
Character. Plot border style, one of the options below.
"none"(default): no border or axis lines."half": axis lines with ticks, but no full border."closed": a full rectangle around the panel.
- align
Character. Alignment of the title, subtitle, and caption, one of the options below.
"panel"(default): align to the plot panel."plot": align to the whole plot, including margins.
- ...
Additional arguments passed to
ggplot2::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 all other text uses Inter. Inter is bundled with the
package and registered automatically on load. Georgia is a system font that
stands in for Insper's proprietary GT Ultra. If Georgia is missing, titles
fall back to the system "serif" family; if Inter is missing, text falls
back to Arial and then to the system "sans" family.
See also
ggplot2::theme_minimal(), ggplot2::theme()
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()
# No grid lines
ggplot(mtcars, aes(x = wt, y = mpg)) +
geom_point() +
theme_insper(grid = FALSE)
# Larger text for slides
ggplot(mtcars, aes(x = wt, y = mpg)) +
geom_point() +
theme_insper(base_size = 16, grid = FALSE)
# Closed border and smaller text for print
ggplot(mtcars, aes(x = wt, y = mpg)) +
geom_point() +
theme_insper(base_size = 11, border = "closed")
}
