nmfspalette

R color palette for NOAA Fisheries official colors.
https://github.com/nmfs-ost/nmfspalette

Category: Biosphere
Sub Category: Marine Life and Fishery

Keywords

color-palette noaa noaa-nsap r

Keywords from Contributors

fisheries stock-synthesis fisheries-stock-assessment stock-assessment control routing virtual transform crop report

Last synced: about 23 hours ago
JSON representation

Repository metadata

:art: an R color palette for NOAA Fisheries official colors

README.Rmd

          ---
output: github_document
---



```{r}
#| include: false
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```

# nmfspalette logo with an image of a fish in multiple palette colors



[![call-r-cmd-check](https://github.com/nmfs-ost/nmfspalette/actions/workflows/call-r-cmd-check.yml/badge.svg)](https://github.com/nmfs-ost/nmfspalette/actions/workflows/call-r-cmd-check.yml)

[![coverage](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/nmfs-ost/nmfspalette/refs/heads/badges/coverage-badge.json)](https://github.com/nmfs-ost/nmfspalette/tree/badges)



An R color palette for `{ggplot2}` using NOAA Fisheries branding colors.

`{nmfspalette}` implements these [steps](https://drsimonj.svbtle.com/creating-corporate-colour-palettes-for-ggplot2) to create a `{ggplot2}` compatible palette according to [NOAA Fisheries branding](https://drive.google.com/file/d/1lXHmfGWCj6pI_Dr3C-Dwcnf1pXOIOztp/view?usp=sharing) (NOAA internal only).

## Installation

You can install the development version of nmfspalette from [GitHub](https://github.com/) with:

```r
# install.packages("pak")
pak::pak("nmfs-ost/nmfspalette")
```

To load the package, use:

```{r}
#| message: false
library(nmfspalette)
```

## Contributing

We welcome contributions to `{nmfspalette}`. You are welcome to make any changes you would like on a fork and submit a pull request. For more substantial changes or to create a branch, please contact [email protected] (NOAA Affiliates only). We ask that all contributors adhere to The NOAA Fisheries Integrated Toolbox [code of conduct](https://github.com/nmfs-ost/Resources/blob/main/CONTRIBUTING.md).

## Usage

To learn how to use `nmfspalette`, please check out the [interactive `learnr` tutorial](https://connect.fisheries.noaa.gov/colors/).

Extract an interpolated color palette from the default "oceans" palette.

You can change the number of colors (10 shown below).

```{r}
#| label: default_pal
nmfs_palette("oceans")(10)
```

## Palettes

To see the palettes, use the `display_nmfs_palette()` function.

### Main NOAA Fisheries palettes

These palettes contain 4 or 6 colors.

#### oceans

```{r}
#| label: displ_oceans
#| fig-height: 2
display_nmfs_palette("oceans", 6)
```


#### waves

```{r}
#| label: displ_waves
#| fig-height: 2
display_nmfs_palette("waves", 4)
```

#### seagrass

```{r}
#| label: displ_seagrass
#| fig-height: 2
display_nmfs_palette("seagrass", 4)
```

#### urchin

```{r}
#| label: displ_urchin
#| fig-height: 2
display_nmfs_palette("urchin", 4)
```

#### crustacean

```{r}
#| label: displ_crustacean
#| fig-height: 2
display_nmfs_palette("crustacean", 4)
```

#### coral

```{r}
#| label: displ_coral
#| fig-height: 2
display_nmfs_palette("coral", 4)
```

#### regional (discrete)

```{r}
#| label: displ_regional_web
#| fig-height: 2
display_nmfs_palette("regional", 6)
```

##### Alternative regional palettes

For some with color vision deficiency (C.V.D.), it may be difficult to discern the colors in the regional palette. We have provided two alternative regional palettes, below.
*Note*: The alternative palette 1 contains colors that are entirely within the NMFS brand color set; alternative palette 2 does not. However, the colors in alternative palette 1 may be less distinguishable for all types of color perception as opposed to alternative palette 2.

```{r, fig.height = 2, displ_regional_web2}
nmfspalette::display_nmfs_palette("regional_alt1", 6)
```

```{r, fig.height = 2, displ_regional_web3}
nmfspalette::display_nmfs_palette("regional_alt2", 6)
```


### NOAA Fisheries complementary colors

These 5 palettes contain 4 complementary colors each and are identical to the main NOAA Fisheries palettes, but some colors have different names. Check out the [nmfs_cols.R file](https://github.com/nmfs-ost/nmfspalette/blob/main/R/nmfs_cols.R) for more information.

### NOAA Fisheries background & tint colors

These palettes contain 4 colors.

#### background sky

```{r}
#| label: displ_background_sky
#| fig-height: 2
display_nmfs_palette("background_sky", 4)
```

#### background green

```{r}
#| label: displ_background_green
#| fig-height: 2
display_nmfs_palette("background_green", 4)
```

#### background gray

```{r}
#| label: displ_background_gray
#| fig-height: 2
display_nmfs_palette("background_gray", 4)
```

### NOAA core colors (Fisheries version)

This palette contains 11 colors.

```{r}
#| label: displ_core
#| fig-height: 2
display_nmfs_palette("core", 11)
```

### NOAA alert colors

These palettes contain 4 colors.

#### alert red

```{r}
#| label: displ_alert_red
#| fig-height: 2
display_nmfs_palette("alert_red", 4)
```

#### alert orange

```{r}
#| label: displ_alert_orange
#| fig-height: 2
display_nmfs_palette("alert_orange", 4)
```

#### alert yellow

```{r}
#| label: displ_alert_yellow
#| fig-height: 2
display_nmfs_palette("alert_yellow", 4)
```

#### alert green

```{r}
#| label: displ_alert_green
#| fig-height: 2
display_nmfs_palette("alert_green", 4)
```

## Examples

In addition to `nmfs_palette` and `display_nmfs_palette` to get palettes, you can extract colors by name. Please see the [NOAA Fisheries Branding guide](https://drive.google.com/file/d/1lXHmfGWCj6pI_Dr3C-Dwcnf1pXOIOztp/view?usp=sharing) (NOAA internal only) for color names. Here, for most color names, underscores are used in place of spaces. Colors defined before 2023 have no spaces in the color names.

```{r}
#| label: nmfs_cols
nmfs_cols("vivid_crustacean")
nmfs_cols("processblue")
```

To use the palettes with `{ggplot2}`, the `scale_color_nmfs()` and `scale_fill_nmfs()` functions are provided. If no argument is given to `scale_color_nmfs()`, a default ("oceans") is used:

```{r}
#| label: default_plot
#| fig-height: 3
library(ggplot2)
p <- ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species)) +
  geom_point(size = 4) +
  scale_color_nmfs()
p
```

`scale_fill_nmfs()` does not have a default and therefore requires a named argument, this is an example using the "crustacean" palette:

```{r}
#| label: scale_fill_example
#| fig-height: 3
ggplot(faithfuld, aes(waiting, eruptions)) +
  geom_raster(aes(fill = density)) +
  scale_fill_nmfs(palette = "crustacean", discrete = FALSE, reverse = TRUE)
```

------------------------------------------------------------------------

## Disclaimer

“The United States Department of Commerce (DOC) GitHub project code is provided on an ‘as is’ basis and the user assumes responsibility for its use. DOC has relinquished control of the information and no longer has responsibility to protect the integrity, confidentiality, or availability of the information. Any claims against the Department of Commerce stemming from the use of its GitHub project will be governed by all applicable Federal law. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by the Department of Commerce. The Department of Commerce seal and logo, or the seal and logo of a DOC bureau, shall not be used in any manner to imply endorsement of any commercial product or activity by DOC or the United States Government.”

------------------------------------------------------------------------

NOAA Fisheries

[U.S. Department of Commerce](https://www.commerce.gov/) \| [National Oceanographic and Atmospheric Administration](https://www.noaa.gov) \| [NOAA Fisheries](https://www.fisheries.noaa.gov/)

        

Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 5 days ago

Total Commits: 162
Total Committers: 9
Avg Commits per committer: 18.0
Development Distribution Score (DDS): 0.426

Commits in past year: 43
Committers in past year: 6
Avg Commits per committer in past year: 7.167
Development Distribution Score (DDS) in past year: 0.605

Name Email Commits
ChristineStawitz-NOAA c****z@n****v 93
Bai Li b****i@n****v 21
sbreitbart-NOAA s****t@n****v 17
Kathryn Doering k****g@n****v 16
github-actions[bot] 4****] 11
corinne.bassin c****n@n****v 1
Nicholas Tierney n****y 1
Julie Rose 1****A 1
Haley Oleynik 7****A 1

Committer domains:


Issue and Pull Request metadata

Last synced: 2 days ago

Total issues: 14
Total pull requests: 62
Average time to close issues: 4 months
Average time to close pull requests: 6 days
Total issue authors: 8
Total pull request authors: 7
Average comments per issue: 1.57
Average comments per pull request: 0.74
Merged pull request: 57
Bot issues: 0
Bot pull requests: 37

Past year issues: 5
Past year pull requests: 40
Past year average time to close issues: 3 months
Past year average time to close pull requests: 4 days
Past year issue authors: 3
Past year pull request authors: 6
Past year average comments per issue: 2.2
Past year average comments per pull request: 1.1
Past year merged pull request: 38
Past year bot issues: 0
Past year bot pull requests: 24

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/nmfs-ost/nmfspalette

Top Issue Authors

  • k-doering-NOAA (5)
  • ChristineStawitz-NOAA (3)
  • iantaylor-NOAA (1)
  • ericward-noaa (1)
  • sbreitbart-NOAA (1)
  • okenk (1)
  • haleyoleynik (1)
  • DanielDaye-NOAA (1)

Top Pull Request Authors

  • github-actions[bot] (37)
  • sbreitbart-NOAA (8)
  • k-doering-NOAA (8)
  • Bai-Li-NOAA (5)
  • njtierney (2)
  • ChristineStawitz-NOAA (1)
  • julierose-NOAA (1)

Top Issue Labels

  • enhancement (3)

Top Pull Request Labels

  • enhancement (2)

Dependencies

DESCRIPTION cran
  • ggplot2 * imports
  • dplyr * suggests
  • testthat * suggests

Score: 5.723585101952381