personalTheme: My personal ggplot2 theme

View source: R/personalTheme.R

personalThemeR Documentation

My personal ggplot2 theme

Description

This function sets up a custom ggplot2 theme for styling plots consistently. It provides options to customize various theme elements, including the size of axis text, the size of the plot title, the position of the legend, and more. This is currently a work in progress.

Usage

personalTheme(
  theme_type = "bw",
  theme_bs = 16,
  ax_title = 1.25,
  ax_text = 1,
  plt_title = 2,
  x_angle = 0,
  x_hjust = 0.5,
  x_vjust = 1,
  striptext = NULL,
  legend_pos = "right",
  legend_keytype = "point",
  legend_title = 1.25,
  legend_text = 1.25,
  legend_keysize = 0.75,
  guide_color = 4,
  guide_fill = 4,
  nopanels = TRUE
)

Arguments

theme_type

Character string specifying the base theme to use. Options are "bw" (default) and "classic".

theme_bs

Numeric value specifying the base font size for the theme.

ax_title

Numeric value specifying the relative size of axis titles.

ax_text

Numeric value specifying the relative size of axis text.

plt_title

Numeric value specifying the relative size of plot titles.

x_angle

Numeric value specifying the angle of x-axis text.

x_hjust

Numeric value specifying the horizontal justification of x-axis text.

x_vjust

Numeric value specifying the vertical justification of x-axis text.

striptext

Character string specifying the strip text to customize. Options are "x", "y", or "right".

legend_pos

Character string specifying the position of the legend. Options are "left", "right", "top", "bottom", or "none".

legend_keytype

Character string specifying the type of legend key. Options are "point" (default) and "fillbar".

legend_title

Numeric value specifying the relative size of legend titles.

legend_text

Numeric value specifying the relative size of legend text.

legend_keysize

Numeric value specifying the size of the legend key for "fillbar".

guide_color

Numeric value specifying the size of the color guide.

guide_fill

Numeric value specifying the size of the fill guide.

nopanels

Logical value specifying whether to remove grid panels from the plot.

Value

A list containing the custom theme and guide settings for ggplot2.

Examples

## Not run: 
# Create a custom theme with black and white color scheme
my_theme <- personalTheme(theme_type = "bw", theme_bs = 16, ax_title = 1.25,
                           ax_text = 1, plt_title = 2, x_angle = 0, x_hjust = 0.5,
                           x_vjust = 1, striptext = "x", legend_pos = "right",
                           legend_keytype = "point", legend_title = 1.25,
                           legend_text = 1.25, legend_keysize = 0.75,
                           guide_color = 4, guide_fill = 4)

## End(Not run)

odavalos/scGrabBag documentation built on Jan. 15, 2025, 11:45 p.m.