Package 'WrensBookshelf'

Title: A Collection of Palettes and Some Functions to Help Use Them
Description: A collection of color palettes that were extracted from various books on my sons(Wren) bookshelf. Also included are a number of functions and wrappers to utilize them, as well as to subset the palettes to desired number/specific colors.
Authors: Benjamin Uveges [aut, cre]
Maintainer: Benjamin Uveges <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2024-11-13 03:43:04 UTC
Source: https://github.com/buveges/wrensbookshelf

Help Index


Use WrensBookshelf with ggplot

Description

Wrapper function to allow easy integration with ggplot2. Sets continuous color scale.

Usage

scale_color_WB_c(name, direction = 1, ...)

Arguments

name

Name of palette from WrensBookshelf.

direction

Direction you want the palette to proceed; 1 = direction shown in ShowBookshelf() or ShowBook(), -1 = reversed.

...

See scale_color_gradientn() for additional params.

Value

No return value, integrates WB_brewer into ggplot2 function.

Examples

ggplot2::ggplot(mtcars, ggplot2::aes(x=disp,y=wt, color = mpg))+
ggplot2::geom_point(size=3)+
scale_color_WB_c(name = "WhatWellBuild")

Use WrensBookshelf with ggplot

Description

Wrapper function to allow easy integration with ggplot2. Sets discrete color scale

Usage

scale_color_WB_d(name, direction = 1, override.order = FALSE, ...)

Arguments

name

Name of palette from WrensBookshelf.

direction

Direction you want the palette to proceed; 1 = direction shown in ShowBookshelf() or ShowBook(), -1 = reversed.

override.order

Argument used to override the prescribed order that colors are selected from palettes for discrete palettes where n < length(palette). Default = FALSE.

...

See discrete_scale() for additional params.

Value

No return value, integrates WB_brewer into ggplot2 function.

Examples

ggplot2::ggplot(mtcars, ggplot2::aes(x = disp,y = wt, color = factor(cyl)))+
ggplot2::geom_point(size=3)+
scale_color_WB_d(name = "YouMatter")

Use WrensBookshelf with ggplot

Description

Wrapper function to allow easy integration with ggplot2. Sets continuous fill scale.

Usage

scale_fill_WB_c(name, direction = 1, ...)

Arguments

name

Name of palette from WrensBookshelf.

direction

Direction you want the palette to proceed; 1 = direction shown in ShowBookshelf() or ShowBook(), -1 = reversed.

...

See scale_color_gradientn() for additional params.

Value

No return value, integrates WB_brewer into ggplot2 function.

Examples

ggplot2::ggplot(mtcars, ggplot2::aes(x = disp,y = wt, fill= mpg))+
ggplot2::geom_point(size=3, shape = 21)+
scale_fill_WB_c(name = "WhatWellBuild")

Use WrensBookshelf with ggplot

Description

Wrapper function to allow easy integration with ggplot2. Sets discrete color scale.

Usage

scale_fill_WB_d(name, direction = 1, override.order = FALSE, ...)

Arguments

name

Name of palette from WrensBookshelf.

direction

Direction you want the palette to proceed; 1 = direction shown in ShowBookshelf() or ShowBook(), -1 = reversed.

override.order

Argument used to override the prescribed order that colors are selected from palettes for discrete palettes where n < length(palette). Default = FALSE.

...

See discrete_scale() for additional params.

Value

No return value, integrates WB_brewer into ggplot2 function.

Examples

ggplot2::ggplot(mtcars, ggplot2::aes(x = disp,y = wt, fill = factor(cyl)))+
ggplot2::geom_point(size = 3, shape = 21)+
scale_fill_WB_d(name = "YouMatter")

View a book palette

Description

Generates a graphic object using a specified palette from WrensBookshelf.

Usage

ShowBook(name)

Arguments

name

Name of desired palette.

Value

Graphic object.

Examples

ShowBook(name ="BabyWrenAndTheGreatGift")

View all of Wren's Books

Description

Generates a graphic object with desired subset of palettes from WrensBookshelf.

Usage

ShowBookshelf(CVDsafe = FALSE, BestFor = NA)

Arguments

CVDsafe

Argument used to restrict displayed palettes to those that are color vision deficiency (CVD) safe. Default is FALSE, set to TRUE to enact filter.

BestFor

Argument used to restrict displayed palettes to those that are best for either continuous or discrete data types. Arguments are "discrete" or "continuous"

Value

Graphic object.

Examples

ShowBookshelf()
ShowBookshelf(CVDsafe = TRUE, BestFor = "continuous")

Customize WrensBookshelf palettes

Description

Function used to create continuous/discrete palettes using the palettes in WrensBookshelf.

Usage

WB_brewer(
  name,
  n,
  type = c("discrete", "continuous"),
  direction = c(1, -1),
  override.order = FALSE
)

Arguments

name

Name of palette from WrensBookshelf

n

Number of colors to select, or size of continuous palette if n > length(palette)

type

Type of palette you wish to generate ("continuous" or "discrete")

direction

Direction you want the palette to proceed; 1 = direction shown in ShowBookshelf() or ShowBook(), -1 = reversed.

override.order

Argument used to override the prescribed order that colors are selected from palettes for discrete palettes where n < length(palette). Default = FALSE.

Value

A color palette.

Examples

WB_brewer(name = "BabyWrenAndTheGreatGift", type = "continuous", n = 200)
WB_brewer(name = "JulienIsAMermaid", type = "discrete",
          direction = -1, n = 7, override.order = TRUE)

Customize WrensBookshelf palettes

Description

Function used to create customized continuous/discrete palettes using the palettes in WrensBookshelf, offering more specific control over selected colors than WB_brewer.

Usage

WB_subset_brewer(
  name,
  n = NA,
  LCR,
  type = c("continuous", "discrete"),
  direction = c(1, -1),
  n2 = NULL
)

Arguments

name

Name of palette from WrensBookshelf.

n

Number of colors to select/subset.

LCR

Location from which you want select n colors from in specified palette ("left","right", "center"). Can also use a vector of specific color numbers within palette (e.g. c(1,4,7))

type

Type of palette you wish to generate ("continuous" or "discrete")

direction

Direction you want the palette to proceed; 1 = direction shown in ShowBookshelf() or ShowBook(), -1 = reversed.

n2

If type = "continuous", length of palette to generate.

Value

Color palette.

Examples

WB_subset_brewer(name = "JulienIsAMermaid", n = 5,
                 LCR = "left", type = "continuous", n2 = 200)
WB_subset_brewer(name = "WhereTheWildThingsAre", type = "discrete", LCR = c(1,4,5,6))

Complete list of palettes.

Description

Use names(WrensBookshelf) to display all possible palette names. Current available palettes: BabyBeluga, BabyWrenAndTheGreatGift, BlueberriesForSal, BoTheBrave, BoTheBraveCVDS, BurtDow, BurtDowCVDS, CapsForSale,FletcherAndTheFallingLeaves, Friends, GoodnightGoodnightConstructionSite, GustavoTheShyGhost1, GustavoTheShyGhost2, HaroldAndThePurpleCrayon, JeffGoesWild, JulienIsAMermaid, KnightOwl, LittleBlueHouseBesideTheSeaCont, LittleBlueHouseBesideTheSeaDisc, Madelline, MakeWayForDucklings, MoreThanALittle, OhThePlacesYoullGo, Opposites, SleepTightFarm1, SleepTightFarm2, StackTheCats, TheDucklingGetsACookie, TheHoneybee, TheHoneybeeDiverging, ThePoutPoutFish, TheRealBoat1, TheRealBoat2, TheSnowyDay, TheStoryOfBabar, TheseWordsIShapedForYou, ThisMooseBelongsToMe, ThreeLittleVikings, TigerDays, TinyPerfectThings, TooCrowded, Vampenguin, WhatWellBuild, WhereTheWildThingsAre, and YouMatter.

Usage

WrensBookshelf

Format

An object of class list of length 50.

Value

No return value, sets a list of palettes to be used with WrensBookshelf functions