On this page

Give a ggplot of your own the theme of the ALSCL plots.

Usage

theme_acl(
  font_family = NULL,
  title_size = NULL,
  axis_title_size = NULL,
  axis_text_size = NULL,
  strip_text_size = NULL,
  legend_text_size = NULL,
  base_theme = NULL,
  title_hjust = NULL,
  quantity = NULL,
  x_angle = NULL
)

Arguments

ArgumentDefaultDescription
font_familyNULL

Character or NULL. Font family; NULL uses the global setting, as in the plot functions.

title_sizeNULL

Numeric or NULL. Size of the title in pt; NULL uses the global setting, as in the plot functions.

axis_title_sizeNULL

Numeric or NULL. Size of the axis titles in pt; NULL uses the global setting, as in the plot functions.

axis_text_sizeNULL

Numeric or NULL. Size of the axis tick labels in pt; NULL uses the global setting, as in the plot functions.

strip_text_sizeNULL

Numeric or NULL. Size of the panel labels in pt; NULL uses the global setting, as in the plot functions.

legend_text_sizeNULL

Numeric or NULL. Size of the legend text in pt; NULL uses the global setting, as in the plot functions.

base_themeNULL

Character or NULL. Base ggplot2 theme name; NULL uses the global setting. Letter case does not matter.

title_hjustNULL

Numeric or NULL. Horizontal position of the title (0 for left, 0.5 for centered, 1 for right); NULL uses the global setting.

quantityNULL

Character or NULL. Under acl_theme_set(title_color = "quantity"), the title takes the color of the quantity named, "stock", "F", "recruitment" or "catch". Under the default title_color = "black" the title is black, and NULL also gives a black title. Letter case does not matter.

x_angleNULL

Numeric or NULL. Angle in degrees of the x tick labels; slanted labels end at their tick mark. NULL uses the global x_angle setting when one is set, and otherwise leaves the labels unchanged.

Value

A list of ggplot2 theme layers, to be added to a ggplot with +.

Details

The layers are those that the plot functions add under the current acl_theme_set() settings, namely the base theme, font and text sizes, grid lines, title face, alignment and color, facet labels and legend position of the active style. Call theme_acl() again after a change of the settings. x_angle slants the x tick labels, for example theme_acl(x_angle = 45). With quantity = "stock", "F", "recruitment" or "catch" the title takes the color of that quantity under title_color = "quantity". Colors of lines, points and fills are not part of a theme; take them from acl_palette(). Under the default style the package plots also start the y axis at zero, which is a scale; add ggplot2::expand_limits(y = 0) to a figure of your own.

Examples

Run the setup before the example. Fitting examples require an R-compatible C++ toolchain; simulation and export examples may write files.

Example setup
library(ALSCL)
# Use objects defined above
d <- data.frame(year = 2001:2010, value = c(3, 5, 4, 6, 8, 7, 9, 8, 10, 11))
ggplot2::ggplot(d, ggplot2::aes(year, value)) +
  ggplot2::geom_line(colour = acl_palette(role = "primary")) +
  ggplot2::labs(title = "My series") +
  theme_acl()

See also

Search documentation