pal_d3: D3.js Color Palettes

Description Usage Arguments Author(s) References Examples

View source: R/discrete-d3.R

Description

Color palettes based on the colors used by D3.js.

Usage

1
2
pal_d3(palette = c("category10", "category20", "category20b", "category20c"),
  alpha = 1)

Arguments

palette

Palette type. There are 4 available options: "category10" (10-color palette); "category20" (20-color palette); "category20b" (20-color palette); "category20c" (20-color palette).

alpha

Transparency level, a real number in (0, 1]. See alpha in rgb for details.

Author(s)

Nan Xiao <[email protected]> | <https://nanx.me>

References

https://github.com/d3/d3-3.x-api-reference/blob/master/Ordinal-Scales.md

Examples

1
2
3
4
5
library("scales")
show_col(pal_d3("category10")(10))
show_col(pal_d3("category20")(20))
show_col(pal_d3("category20b")(20))
show_col(pal_d3("category20c")(20))

Example output



ggsci documentation built on Sept. 30, 2017, 5:04 p.m.