Skip to contents

Returns a ggplot2 theme based on user's choice or a custom theme if provided.

Usage

mStat_get_theme(theme.choice = "bw", custom.theme = NULL)

Arguments

theme.choice

Character string specifying the ggplot2 theme to use. Options include:

  • "bw": Black and white theme (theme_bw)

  • "classic": Classic theme (theme_classic)

  • "gray": Gray theme (theme_gray)

  • "light": Light theme (theme_light)

  • "dark": Dark theme (theme_dark)

  • "minimal": Minimal theme (theme_minimal)

  • "void": Void theme (theme_void)

  • "prism": GraphPad Prism-like theme

Can also use a custom ggplot2 theme object via custom.theme.

custom.theme

A custom ggplot2 theme object to override theme.choice. Should be created using ggplot2::theme() or a complete theme function.

Value

A ggplot2 theme object to be used in plotting functions.

Details

The function simplifies the process of theme selection in plotting functions by providing a standardized way to choose between several common themes or to use a custom theme.

Examples

if (FALSE) { # \dontrun{
# Using a pre-defined theme
theme_to_use <- mStat_get_theme(theme.choice = "bw")

# Using a custom theme
my_custom_theme <- theme_minimal() + theme(axis.text.x = element_text(angle = 45))
theme_to_use <- mStat_get_theme(custom.theme = my_custom_theme)
} # }