Description Usage Arguments Details Value Note Examples
Uses the built-in clear_sans_pkg custom font.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27  | theme_cs(
  base_size = 10,
  line_height = 0.875,
  plot_title_size = 18,
  plot_title_position = "panel",
  plot_title_margin = 8,
  subtitle_size = 12,
  subtitle_margin = 10,
  strip_text_size = 12,
  strip_placement = "outer",
  caption_size = 9,
  caption_margin = 11,
  axis_text_size = base_size,
  axis_title_size = 9,
  axis_title_just = "rt",
  panel_spacing = grid::unit(2, "lines"),
  plot_margin = margin(30, 30, 30, 30),
  mode = c("light", "dark", "rstudio"),
  background_colour = theme_background_color(mode, light = "white", dark = "#121212"),
  foreground_colour = theme_foreground_color(mode, light = "#262626", dark = "#e1e1e1"),
  grid_col = theme_foreground_color(mode, light = "#cccccc", dark = "#606367"),
  axis_col = theme_foreground_color(mode, light = "#2b2b2b", dark = "#606367"),
  grid = TRUE,
  axis = FALSE,
  axis_text = TRUE,
  ticks = FALSE
)
 | 
base_size | 
 base font size  | 
line_height | 
 default line height  | 
plot_title_size | 
 plot title size  | 
plot_title_position | 
 plot title position  | 
plot_title_margin | 
 plot title margin  | 
subtitle_size | 
 subtitle size  | 
subtitle_margin | 
 subtitle margin  | 
strip_text_size | 
 strip text size  | 
strip_placement | 
 strip placement  | 
caption_size | 
 caption size  | 
caption_margin | 
 caption margin  | 
axis_text_size | 
 axis text size  | 
axis_title_size | 
 axis title size  | 
axis_title_just | 
 axis title just  | 
panel_spacing | 
 panel spacing  | 
plot_margin | 
 plot margin  | 
grid_col | 
 grid col  | 
axis_col | 
 axis col  | 
grid | 
 grid  | 
axis | 
 axis  | 
axis_text | 
 axis text labels  | 
ticks | 
 ticks  | 
text_geom_size | 
 text geom size  | 
background_colour dark mode is "#121212" else "white"
foreground_colour dark mode is "#e1e1e1" else "#262626"
grid_col dark mode is "#606367" else "#cccccc"
axis_col dark mode is "#606367" else "#2b2b2b"
ggplot2 theme
this function updates Geom defaults; use reset_ggplot2_defaults() to
restore ggplot2 geom default aeshetics
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19  | ggplot() +
  geom_point(
    data = mtcars,
    aes(mpg, wt)
  ) +
  geom_label(
    aes(
      x = 30, y = 4.5,
      label = "A fairly useless\nannotation that\nuses the custom\nClear Sans variant\nby default."
    ),
    label.size = 0
  ) +
  labs(
    x = "Fuel efficiency (mpg)", y = "Weight (tons)",
    title = "Seminal ggplot2 scatterplot example",
    subtitle = "A plot that is only useful for demonstration purposes",
    caption = "Brought to you by the letter 'g'"
  ) +
  theme_cs(grid = "XY")
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.