Create theme for nmfs colors

theme_nmfs(
  palette = "oceans",
  discrete = TRUE,
  reverse = FALSE,
  interpolate = TRUE,
  base_size = 14,
  lab_size = 12,
  ink = "black",
  paper = "white",
  accent = "#003087",
  ...
)

Arguments

palette

Character name of palette in nmfs_palettes. Default value is "oceans".

discrete

Boolean indicating whether color aesthetic is discrete. Default is TRUE.

reverse

Boolean indicating whether the palette should be reversed. Default is FALSE.

interpolate

Boolean indicating whether the colors assigned to plot objects should interpolated from palettes, with the alternative that only the defined colors in the palette are used. Default is TRUE.

base_size

The base font size, as defined in the ggplot2::theme_gray() function

lab_size

The axis text size

ink

The plot foreground color, as defined in the ggplot2::theme_gray() function

paper

The plot background color, as defined in the ggplot2::theme_gray() function

accent

The plot's accented elements' color, as defined in the ggplot2::theme_gray() function

...

Additional arguments passed to: ggplot2::scale_fill_gradientn() when discrete is TRUE; ggplot2::discrete_scale() when discrete is FALSE and interpolate is TRUE; and ggplot2::scale_fill_manual() when discrete is FALSE and interpolate is FALSE.

Value

A theme that applies nmfs color palettes and theme-related elements (such as label sizes, borders, axis lines, and more) to a plot. For more information about the ggplot2 advances that enabled this function, check out the ggplot2 version 4.0.0 release notes.

Examples

library(ggplot2)
ggplot(mtcars, aes(x = mpg, y = disp, color = as.factor(cyl))) +
  geom_point(size = 3) +
  theme_nmfs(discrete = TRUE, interpolate = TRUE, palette = "crustacean")

ggplot(mtcars, aes(x = mpg, y = disp, color = as.factor(cyl))) +
  geom_point(size = 3) +
  theme_nmfs(discrete = TRUE, interpolate = FALSE, palette = "crustacean")
#>  The crustacean palette has 4 colors.

ggplot(mtcars, aes(x = mpg, y = disp, fill = hp)) +
  geom_point(size = 3, shape = 24) +
  theme_nmfs(discrete = FALSE, interpolate = TRUE, palette = "seagrass")