theme_less_minimal: Function for a minimal *ggplot2* appearance but with bounding...

View source: R/theme_less_minimal.R

theme_less_minimalR Documentation

Function for a minimal ggplot2 appearance but with bounding lines for plot area.

Description

Function for a minimal ggplot2 appearance but with bounding lines for plot area.

Usage

theme_less_minimal(
  base_size = 11,
  base_family = "",
  base_line_size = base_size/22,
  base_rect_size = base_size/22,
  narrow_strips = TRUE,
  x_label_rotate = 0,
  legend_position = NA
)

theme_narrow_strips(x_strip_margin = 2.2, y_strip_margin = 2.5)

theme_x_label_rotate(angle = 45)

ggplot_caption_format(location = "left", size = NULL)

Arguments

base_size

Base font size.

base_family

Base font family.

base_line_size

Base size for line elements.

base_rect_size

Base size for rectangle elements.

narrow_strips

Should the plot have narrow strips for facet headings?

x_label_rotate

Angle for x-axes labels.

legend_position

The position of the legend ("none", "left", "right", "bottom", "top", or two-element numeric vector).

x_strip_margin, y_strip_margin

Margins for strip headings.

angle

Angle of text.

location, size

Specific arguments for ggplot_caption_format.

Value

Invisible, modification to a ggplot2 plot.

Author(s)

Stuart K. Grange

Examples


# Load package
library(ggplot2)

# Create data
data_example <- tibble::tibble(
  x = seq(1:3), 
  y = sample(1:10, 3),
  facet_heading = "The plot"
)

# Plot with the theme
ggplot(data_example, aes(x, y)) + 
  geom_point() + 
  facet_wrap("facet_heading") + 
  theme_less_minimal()
  
# Plot with the theme with some options
ggplot(data_example, aes(x, y)) + 
  geom_point() + 
  facet_wrap("facet_heading") + 
  theme_less_minimal(narrow_strips = TRUE, x_label_rotate = 45)
  
# Plot and move legend
ggplot(data_example, aes(x, y, colour = facet_heading)) + 
  geom_point() + 
  theme_less_minimal(legend_position = "bottom")
  
# Plot and move legend
ggplot(data_example, aes(x, y, colour = facet_heading)) + 
  geom_point() + 
  theme_less_minimal() + 
  labs(caption = "A caption") + 
  ggplot_caption_format(size = 10)


skgrange/threadr documentation built on May 11, 2024, 12:16 p.m.