theme_jml: my preferred basic ggplot theme R code for my preferred...

View source: R/theme_jml.R

theme_jmlR Documentation

my preferred basic ggplot theme R code for my preferred ggplot theme

Description

Can be called as a function from this package, or can be loaded from a Github gist containing the same code.

Usage

theme_jml(
  base_size = 11,
  base_family = "sans",
  labels_color = "black",
  axis_color = "black",
  bg_color = "transparent",
  grid_color = "grey90",
  legend.position = "bottom"
)

Examples

library(tidyverse)
pl_mtc <- mtcars |> 
 ggplot(aes(cyl, mpg)) +
 geom_point()
 
 pl_mtc + theme_gray()
 pl_mtc + theme_classic()
 pl_mtc + theme_jml()

#OGTT example:
data("ogtt_nested")
ogtt_long <- 
 ogtt_nested |> 
 select(id, ogtt_df) |> 
 unnest(cols = ogtt_df) |> 
 group_by(id)

pl_ogtt <- ogtt_long |> 
 ggplot(aes(time, glucose, group=id)) +
 geom_line(alpha=0.3)
 
 pl_ogtt + theme_jml()
 
#' to make this the active theme for all plots:
theme_set(theme_jml())
pl_ogtt

JMLuther/tabletools documentation built on April 14, 2025, 3:09 a.m.