| Title: | A Color Palette for NOAA Fisheries |
|---|---|
| Description: | This is a package that implements a color palette in line with the NOAA Fisheries Branding Guide. |
| Authors: | Christine Stawitz [aut], Bai Li [aut], Kathryn Doering [ctb], Sophie Breitbart [cre], Steve Saul [ctb], Sam Schiano [ctb] |
| Maintainer: | Sophie Breitbart <[email protected]> |
| License: | GPL-3 | file LICENSE |
| Version: | 3.3.0.000 |
| Built: | 2026-05-21 10:16:02 UTC |
| Source: | https://github.com/nmfs-ost/nmfspalette |
Return function that shows all nmfs color palettes
all_nmfs_palettes()all_nmfs_palettes()
A null object showing all nmfs color palettes in the plot window.
all_nmfs_palettes()all_nmfs_palettes()
Return interpolated nmfs color palette
display_nmfs_palette(name, n)display_nmfs_palette(name, n)
name |
Character name of palette in nmfs_palettes. |
n |
Number of colors in palette. |
An object showing a specific nmfs color palette in the plot window.
display_nmfs_palette("oceans", 10)display_nmfs_palette("oceans", 10)
Function to extract nmfs colors as hex codes
nmfs_cols(...)nmfs_cols(...)
... |
Character names of nmfs_colors |
nmfs_cols("processblue")nmfs_cols("processblue")
Return function to interpolate a nmfs color palette
nmfs_palette(palette = "oceans", reverse = FALSE, ...)nmfs_palette(palette = "oceans", reverse = FALSE, ...)
palette |
Character name of palette in |
reverse |
Boolean indicating whether the palette should be reversed. Default value is FALSE. |
... |
Additional arguments to pass to |
nmfs_palette("oceans")(10) # or equivalently oceans_pal <- nmfs_palette("oceans") oceans_pal(10)nmfs_palette("oceans")(10) # or equivalently oceans_pal <- nmfs_palette("oceans") oceans_pal(10)
Color scale constructor for nmfs colors
scale_color_nmfs( palette = "oceans", discrete = TRUE, reverse = FALSE, interpolate = TRUE, ... )scale_color_nmfs( palette = "oceans", discrete = TRUE, reverse = FALSE, interpolate = TRUE, ... )
palette |
Character name of palette in |
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: |
library(ggplot2) ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species)) + geom_point(size = 4) + scale_color_nmfs("coral") ggplot(mtcars, aes(mpg, disp, color = as.factor(gear))) + geom_point(size = 4) + scale_color_nmfs("regional", interpolate = FALSE, discrete = TRUE )library(ggplot2) ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species)) + geom_point(size = 4) + scale_color_nmfs("coral") ggplot(mtcars, aes(mpg, disp, color = as.factor(gear))) + geom_point(size = 4) + scale_color_nmfs("regional", interpolate = FALSE, discrete = TRUE )
Fill scale constructor for nmfs colors
scale_fill_nmfs( palette = "oceans", discrete = TRUE, reverse = FALSE, interpolate = TRUE, ... )scale_fill_nmfs( palette = "oceans", discrete = TRUE, reverse = FALSE, interpolate = TRUE, ... )
palette |
Character name of palette in |
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: |
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 )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 )
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", ... )theme_nmfs( palette = "oceans", discrete = TRUE, reverse = FALSE, interpolate = TRUE, base_size = 14, lab_size = 12, ink = "black", paper = "white", accent = "#003087", ... )
palette |
Character name of palette in |
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
|
lab_size |
The axis text size |
ink |
The plot foreground color, as defined in the
|
paper |
The plot background color, as defined in the
|
accent |
The plot's accented elements' color, as defined in the
|
... |
Additional arguments passed to: |
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.
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") ggplot(mtcars, aes(x = mpg, y = disp, fill = hp)) + geom_point(size = 3, shape = 24) + theme_nmfs(discrete = FALSE, interpolate = TRUE, palette = "seagrass")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") ggplot(mtcars, aes(x = mpg, y = disp, fill = hp)) + geom_point(size = 3, shape = 24) + theme_nmfs(discrete = FALSE, interpolate = TRUE, palette = "seagrass")