Giter VIP home page Giter VIP logo

nmfspalette's Introduction

nmfspalette

an R color palette for ggplot2 using NOAA Fisheries branding colors

R-CMD-check


This implements these steps to create a ggplot2 compatible palette according to NOAA Fisheries branding.

Installation

To install from Github use the following:

remotes::install_github("nmfs-general-modeling-tools/nmfspalette")
library(nmfspalette)

Usage

Extract an interpolated color palette from the default “oceans” palette. You can change the number of colors (10 shown below).

nmfspalette::nmfs_palette("oceans")(10)
#>  [1] "#0093D0" "#007EC1" "#0069B2" "#0055A4" "#005097" "#004B8B" "#00467F"
#>  [8] "#5483A9" "#A9C1D4" "#FFFFFF"

Palettes

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

oceans

nmfspalette::display_nmfs_palette("oceans", 4)

waves

nmfspalette::display_nmfs_palette("waves", 4)

seagrass

nmfspalette::display_nmfs_palette("seagrass", 4)

urchin

nmfspalette::display_nmfs_palette("urchin", 4)

crustacean

nmfspalette::display_nmfs_palette("crustacean", 4)

coral

nmfspalette::display_nmfs_palette("coral", 4)

regional web (discrete)

nmfspalette::display_nmfs_palette("regional web", 6)

secondary (discrete)

nmfspalette::display_nmfs_palette("secondary", 4)

Examples

In addition to nmfs_palette and display_nmfs_palette to get in-built palettes, you can extract colors by name. Please see the NOAA Fisheries Branding guide for color names, all spaces are replaced with underscores in the color names.

nmfspalette::nmfs_cols("process_blue")
#> process_blue 
#>    "#0093D0"

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:

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 for now, this is an example using the “crustacean” palette

ggplot(mpg, aes(manufacturer, fill = manufacturer)) +
    geom_bar() +
    theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
    scale_fill_nmfs(palette = "crustacean")


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.”


nmfspalette's People

Contributors

christinestawitz-noaa avatar corinnebassin-noaa avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.