8  Theme

Print available themes using available_themes():

available_themes()
  Available themes:
    "white", "whitegrid", "whiteigrid,
    "black", "blackgrid", "blackigrid",
    "darkgray", "darkgraygrid", "darkgrayigrid",
    "lightgraygrid", "mediumgraygrid"
set.seed <- 2025
x <- rnorm(200)
y <- x^3 + 12 + rnorm(200)
draw_scatter(x, y, theme = "white", fit = "gam")
draw_scatter(x, y, theme = "whitegrid", fit = "gam")
draw_scatter(x, y, theme = "whiteigrid", fit = "gam")
draw_scatter(x, y, theme = "lightgraygrid", fit = "gam")
draw_scatter(x, y, theme = "mediumgraygrid", fit = "gam")
draw_scatter(x, y, theme = "darkgray", fit = "gam")
draw_scatter(x, y, theme = "darkgraygrid", fit = "gam")
draw_scatter(x, y, theme = "darkgrayigrid", fit = "gam")
draw_scatter(x, y, theme = "black", fit = "gam")
draw_scatter(x, y, theme = "blackgrid", fit = "gam")
draw_scatter(x, y, theme = "blackigrid", fit = "gam")

8.1 Customize theme

Each theme has a corresponding theme_* function that allows you to customize every aspect of the theme.

draw_scatter(
  x, y,
  theme = theme_whitegrid(
    grid_col = "blue", zerolines_col = "red", zerolines_lwd = 2.0)
)

8.2 Color palettes

rtemis includes a number of builtin color palettes, along with a few functions to create, manipulate, and preview colors.

rtpalette()
2025-06-04 10:46:07 The following palettes are available: [rtpalette]
 [1] "ucsfCol"             "pennCol"             "imperialCol"        
 [4] "stanfordCol"         "ucdCol"              "berkeleyCol"        
 [7] "ucscCol"             "ucmercedCol"         "ucsbCol"            
[10] "uclaCol"             "ucrColor"            "uciCol"             
[13] "ucsdCol"             "ucCol"               "scrippsCol"         
[16] "caltechCol"          "cmuCol"              "princetonCol"       
[19] "columbiaCol"         "yaleCol"             "brownCol"           
[22] "cornellCol"          "hmsCol"              "dartmouthCol"       
[25] "usfCol"              "uwCol"               "jhuCol"             
[28] "nyuCol"              "washuCol"            "chicagoCol"         
[31] "pennstateCol"        "msuCol"              "michiganCol"        
[34] "iowaCol"             "texasCol"            "techCol"            
[37] "jeffersonCol"        "hawaiiCol"           "nihCol"             
[40] "torontoCol"          "mcgillCol"           "uclCol"             
[43] "oxfordCol"           "nhsCol"              "ethCol"             
[46] "rwthCol"             "firefoxCol"          "mozillaCol"         
[49] "appleCol"            "googleCol"           "amazonCol"          
[52] "microsoftCol"        "pantoneBalancingAct" "pantoneWellspring"  
[55] "pantoneAmusements"   "grays"               "rtCol1"             
[58] "rtCol3"             

Let’s use previewcolor() to look at a selection of the available palettes:

previewcolor(rtpalette("imperialCol"), "Imperial")

previewcolor(rtpalette("ucsfCol"), "UCSF")

previewcolor(rtpalette("pennCol"), "Penn")

previewcolor(rtpalette("stanfordCol"), "Stanford")

previewcolor(rtpalette("berkeleyCol"), "Berkeley")

previewcolor(rtpalette("firefoxCol"), "Firefox")

8.3 System Defaults

You can optionally set system defaults by running the following lines in R or adding them to your .Rprofile file, which is usually found in your home directory. For example, to default to the “darkgrayigrid” theme (works well with a dark VS Code or RStudio theme), you can use the following:

options(rtemis_theme = "darkgrayigrid")
options(rtemis_palette = "rtCol3")
options(rtemis_font = "Geist")

The first line sets the theme for all draw_* functions that support it, and the second line defines the default palette, which works with both light and dark themes.

© 2025 E.D. Gennatas