use_sgplot: Use sgplot defaults.

View source: R/use_sgplot.R

use_sgplotR Documentation

Use sgplot defaults.

Description

Set sgplot theme, colour palette and geom aesthetic defaults for ggplot2 charts.

Usage

use_sgplot(
  palette_type = "sg",
  quietly = FALSE,
  ...,
  default_colour = deprecated()
)

Arguments

palette_type

Name of palette type to use. Defaults to "sg". For all available palette types, run available_palette_types().

quietly

Should the function run quietly? By default, use_sgplot() prints information messages to the console. Set quietly = TRUE to suppress these.

...

Arguments passed to sgplot::theme_sg().

default_colour

[Deprecated] Use the palette_type argument instead.

Value

NULL. Function is used for side effects of setting default ggplot2 theme, colour palette and geom aesthetics.

Examples

library(ggplot2)

d <- subset(mpg, manufacturer == "ford")

# ggplot2 defaults
ggplot(d, aes(x = model)) + geom_bar()
ggplot(d, aes(x = model, fill = class)) + geom_bar()

# Use sgplot defaults
use_sgplot()
ggplot(d, aes(x = model)) + geom_bar()
ggplot(d, aes(x = model, fill = class, colour = class)) + geom_bar()

# Use sgplot defaults and Social Security Scotland colour palettes
use_sgplot(palette_type = "sss")
ggplot(d, aes(x = model)) + geom_bar()
ggplot(d, aes(x = model, fill = class, colour = class)) + geom_bar()


sgplot documentation built on Jan. 13, 2026, 5:06 p.m.