Fill scale constructor for nmfs colors

scale_fill_nmfs(
  palette = "oceans",
  discrete = TRUE,
  reverse = FALSE,
  interpolate = TRUE,
  ...
)

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.

...

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.

Examples

library(ggplot2)
ggplot(mpg, aes(x = hwy, y = cty, fill = cyl)) +
  geom_point(shape = 21) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  scale_fill_nmfs(palette = "crustacean", discrete = FALSE)


ggplot(mtcars, aes(mpg, disp, color = as.factor(gear))) +
  geom_point(size = 4) +
  scale_fill_nmfs("regional",
    interpolate = FALSE,
    discrete = TRUE
  )
#>  The regional palette has 6 colors.
#> Warning: An error will occur if there are too few palette colors for your plot.
#> To avoid this error, use a larger palette or `interpolate = TRUE`.
#> This warning is displayed once per session.