theme_kyle: Custom ggplot2 theme

View source: R/ggplot_theme.R

theme_kyleR Documentation

Custom ggplot2 theme

Description

Custom ggplot2 theme

Usage

theme_kyle(
  base_size = 12,
  axes = "bl",
  grid = "hv",
  grid_minor = "",
  legend = "right",
  map = FALSE,
  scale = 1.125,
  ...
)

Arguments

base_size

The base_size of the font. Title, axis text, etc. all adjust to base_size. Default is 14.

axes

A string indicating which axes should have lines and ticks. Specify which axes to show by including the matching characters in the string: "t" for top, "r" for right, "b" for bottom, "l" for left. You will need to ensure this argument is consistent with the axes settings in your plot for the lines and ticks to be displayed. The default is an empty string, meaning ticks and lines for the bottom and left axes are shown by default.

grid

A string indicating which gridlines should be shown. Specify the gridlines to show by including the matching characters in the string: "h" for horizontal, "v" for vertical. The default is "hv", meaning both gridlines are shown by default.

grid_minor

A string indicating which gridlines should be shown. Specify the gridlines to show by including the matching characters in the string: "h" for horizontal, "v" for vertical. The default takes the value of grid unless overriden.

legend

Either "top", "bottom", or "right".

map

Logical. If true, clear axes and plot for maps. Could alternatively add theme_map to plot.

scale

logical.

...

Additional options passed to ggplot2::theme

Value

A (complete) ggplot2 theme

Examples


ggplot2::ggplot(mtcars) +
  ggplot2::geom_point(ggplot2::aes(x = mpg, y = hp)) +
  theme_kyle(base_size = 18)

ggplot2::ggplot(mtcars) +
  ggplot2::geom_point(ggplot2::aes(x = mpg, y = hp)) +
  ggplot2::facet_wrap(~cyl) +
  ggplot2::labs(
    title = "mtcars Dataset",
    x = "Miles per Gallon", y = "Horsepower"
  ) +
  theme_kyle(base_size = 18)


kylebutts/kfbmisc documentation built on April 17, 2025, 5:20 p.m.