Skip to contents

Centralized ggplot2 theme for all av_plot_* functions. Ensures consistent, publication-ready styling across the package (high-contrast black text, clean grids, bold titles).

Usage

av_theme_alpha(base_size = 13, base_family = "sans", scale_factor = 1)

Arguments

base_size

Numeric. Base font size (default 13).

base_family

Character. Font family (default "sans", maps to Arial/Helvetica).

scale_factor

Numeric. Legacy scaling multiplier (default 1). Ignored when the av_scale_factor option is set.

Value

A ggplot2::theme object.

Details

Scaling is controlled via the R option av_scale_factor (set by render_av_plot() in Shiny). Outside Shiny the option defaults to 1.0, so reports and console use remain unaffected. The explicit scale_factor parameter is kept for backward compatibility but is overridden when the option is set.

Examples

example_file <- system.file(
  "extdata", "bcl11a_rs1427407_example.csv", package = "AlphaVaR"
)
obj <- av_import_csv(example_file)
#> Reading bcl11a_rs1427407_example.csv ...

# Every av_plot_* function already carries the theme. Adding it a second
# time is how a figure panel gets a smaller base size than the default.
p <- av_plot_distribution(obj, style = "density", group_by = "output_type")
p_small <- p + av_theme_alpha(base_size = 10)
p_small$theme$axis.title$size
#> [1] 10

# The option wins over the arguments, which is the hook render_av_plot()
# uses to shrink a plot for a narrow Shiny column.
withr::with_options(
  list(av_scale_factor = 0.6),
  av_theme_alpha()$text$size
)
#> [1] 7.8