Package 'ggsci'

Title: Scientific Journal and Sci-Fi Themed Color Palettes for 'ggplot2'
Description: A collection of 'ggplot2' color palettes inspired by plots in scientific journals, data visualization libraries, science fiction movies, and TV shows.
Authors: Nan Xiao [aut, cre] , Joshua Cook [ctb], Clara Jégousse [ctb], Hui Chen [ctb], Miaozhu Li [ctb]
Maintainer: Nan Xiao <[email protected]>
License: GPL (>= 3)
Version: 3.2.0
Built: 2024-11-14 04:44:43 UTC
Source: https://github.com/nanxstats/ggsci

Help Index


AAAS journal color palettes

Description

Color palettes inspired by plots in journals published by American Association for the Advancement of Science (AAAS), such as Science and Science Translational Medicine.

Usage

pal_aaas(palette = c("default"), alpha = 1)

Arguments

palette

Palette type. Currently there is one available option: "default" (10-color palette inspired by Science).

alpha

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

Author(s)

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

Examples

library("scales")
show_col(pal_aaas("default")(10))
show_col(pal_aaas("default", alpha = 0.6)(10))

BMJ color palettes

Description

Color palette from the BMJ living style guide.

Usage

pal_bmj(palette = c("default"), alpha = 1)

Arguments

palette

Palette type. Currently there is one available option: "default" (9-color palette).

alpha

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

Author(s)

Hui Chen | [email protected]

References

https://technology.bmj.com/living-style-guide/colour.html

Examples

library("scales")
show_col(pal_bmj("default")(9))
show_col(pal_bmj("default", alpha = 0.6)(9))

Bootstrap 5 color palettes

Description

Bootstrap 5 color palettes.

Usage

pal_bs5(
  palette = c("blue", "indigo", "purple", "pink", "red", "orange", "yellow", "green",
    "teal", "cyan", "gray"),
  n = 10,
  alpha = 1,
  reverse = FALSE
)

Arguments

palette

Palette type. There are 11 available options:

  • "blue"

  • "indigo"

  • "purple"

  • "pink"

  • "red"

  • "orange"

  • "yellow"

  • "green"

  • "teal"

  • "cyan"

  • "gray"

n

Number of individual colors to be generated.

alpha

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

reverse

Logical. Should the order of the colors be reversed?

Author(s)

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

Examples

library("scales")
show_col(pal_bs5("indigo")(10))
show_col(pal_bs5("indigo", n = 30, alpha = 0.6, reverse = TRUE)(30))

COSMIC color palettes

Description

Color palettes inspired by the colors used in projects from the Catalogue Of Somatic Mutations in Cancers (COSMIC).

Usage

pal_cosmic(
  palette = c("hallmarks_light", "hallmarks_dark", "signature_substitutions"),
  alpha = 1
)

Arguments

palette

Palette type. Currently there are three available options:

  • "signature_substitutions" (6-color palette).

  • "hallmarks_light" (10-color palette).

  • "hallmarks_dark" (10-color palette).

The "hallmarks_light" option is from Hanahan and Weinberg (2011).

alpha

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

Author(s)

Joshua H. Cook | [email protected] | @jhrcook

Examples

library("scales")
show_col(pal_cosmic("hallmarks_light")(10))
show_col(pal_cosmic("hallmarks_light", alpha = 0.6)(10))
show_col(pal_cosmic("hallmarks_dark")(10))
show_col(pal_cosmic("hallmarks_dark", alpha = 0.6)(10))
show_col(pal_cosmic("signature_substitutions")(6))
show_col(pal_cosmic("signature_substitutions", alpha = 0.6)(6))

D3.js color palettes

Description

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

Usage

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

Arguments

palette

Palette type. There are four 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 grDevices::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

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))

Flat UI color palettes

Description

Color palettes inspired by the Flat UI colors.

Usage

pal_flatui(palette = c("default", "flattastic", "aussie"), alpha = 1)

Arguments

palette

Palette type. Currently there are three available options:

  • "default" (10-color palette).

  • "flattastic" (12-color palette).

  • "aussie" (10-color palette).

alpha

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

Author(s)

Clara Jégousse | [email protected]

Examples

library("scales")
show_col(pal_flatui("default")(10))
show_col(pal_flatui("flattastic")(12))
show_col(pal_flatui("aussie")(10))
show_col(pal_flatui("aussie", alpha = 0.6)(10))

Frontiers journal color palettes

Description

Color palettes inspired by the colors used in Frontiers journals.

Usage

pal_frontiers(palette = c("default"), alpha = 1)

Arguments

palette

Palette type. Currently there is one available option: "default" (10-color palette).

alpha

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

Author(s)

Clara Jégousse | [email protected]

Examples

library("scales")
show_col(pal_frontiers("default")(7))
show_col(pal_frontiers("default", alpha = 0.6)(7))

Futurama color palettes

Description

Color palettes inspired by the colors used in Futurama.

Usage

pal_futurama(palette = c("planetexpress"), alpha = 1)

Arguments

palette

Palette type. Currently there is one available option: "planetexpress" (12-color palette).

alpha

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

Author(s)

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

Examples

library("scales")
show_col(pal_futurama("planetexpress")(12))
show_col(pal_futurama("planetexpress", alpha = 0.6)(12))

The GSEA GenePattern color palettes

Description

Color palette inspired by the colors used in the heatmaps plotted by GSEA GenePattern.

Usage

pal_gsea(palette = c("default"), n = 12, alpha = 1, reverse = FALSE)

Arguments

palette

Palette type. Currently there is one available option: "default" (continuous palette with 12 base colors).

n

Number of individual colors to be generated.

alpha

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

reverse

Logical. Should the order of the colors be reversed?

Author(s)

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

Examples

library("scales")
show_col(pal_gsea("default")(12))
show_col(pal_gsea("default", n = 30, alpha = 0.6, reverse = TRUE)(30))

Integrative Genomics Viewer (IGV) color palettes

Description

Color palettes based on the colors used by Integrative Genomics Viewer (IGV).

Usage

pal_igv(palette = c("default", "alternating"), alpha = 1)

Arguments

palette

Palette type. There are two available options:

  • "default" (51-color palette).

  • "alternating" (2-color palette).

alpha

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

Author(s)

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

References

James T. Robinson, Helga Thorvaldsdóttir, Wendy Winckler, Mitchell Guttman, Eric S. Lander, Gad Getz, Jill P. Mesirov. Integrative Genomics Viewer. Nature Biotechnology 29, 24–26 (2011).

Examples

library("scales")
show_col(pal_igv("default")(51))
show_col(pal_igv("alternating")(2))

Journal of the American Medical Association color palettes

Description

Color palette inspired by plots in The Journal of the American Medical Association.

Usage

pal_jama(palette = c("default"), alpha = 1)

Arguments

palette

Palette type. Currently there is one available option: "default" (7-color palette).

alpha

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

Author(s)

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

Examples

library("scales")
show_col(pal_jama("default")(7))
show_col(pal_jama("default", alpha = 0.6)(7))

Journal of Clinical Oncology color palettes

Description

Color palette inspired by plots in Journal of Clinical Oncology.

Usage

pal_jco(palette = c("default"), alpha = 1)

Arguments

palette

Palette type. Currently there is one available option: "default" (10-color palette).

alpha

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

Author(s)

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

Examples

library("scales")
show_col(pal_jco("default")(10))
show_col(pal_jco("default", alpha = 0.6)(10))

Lancet journal color palettes

Description

Color palettes inspired by plots in Lancet journals, such as Lancet Oncology.

Usage

pal_lancet(palette = c("lanonc"), alpha = 1)

Arguments

palette

Palette type. Currently there is one available option: "lanonc" (9-color palette inspired by Lancet Oncology).

alpha

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

Author(s)

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

Examples

library("scales")
show_col(pal_lancet("lanonc")(9))
show_col(pal_lancet("lanonc", alpha = 0.6)(9))

LocusZoom color palette

Description

Color palettes based on the colors used by LocusZoom.

Usage

pal_locuszoom(palette = c("default"), alpha = 1)

Arguments

palette

Palette type. Currently there is one available option: "default" (7-color palette).

alpha

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

Author(s)

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

References

Pruim, Randall J., et al. (2010). LocusZoom: regional visualization of genome-wide association scan results. Bioinformatics, 26(18), 2336–2337.

Examples

library("scales")
show_col(pal_locuszoom("default")(7))
show_col(pal_locuszoom("default", alpha = 0.6)(7))

Material Design color palettes

Description

Material Design 2 color palettes.

Usage

pal_material(
  palette = c("red", "pink", "purple", "deep-purple", "indigo", "blue", "light-blue",
    "cyan", "teal", "green", "light-green", "lime", "yellow", "amber", "orange",
    "deep-orange", "brown", "grey", "blue-grey"),
  n = 10,
  alpha = 1,
  reverse = FALSE
)

Arguments

palette

Palette type. There are 19 available options:

  • "red"

  • "pink"

  • "purple"

  • "deep-purple"

  • "indigo"

  • "blue"

  • "light-blue"

  • "cyan"

  • "teal"

  • "green"

  • "light-green"

  • "lime"

  • "yellow"

  • "amber"

  • "orange"

  • "deep-orange"

  • "brown"

  • "grey"

  • "blue-grey"

n

Number of individual colors to be generated.

alpha

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

reverse

Logical. Should the order of the colors be reversed?

Author(s)

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

Examples

library("scales")
show_col(pal_material("indigo")(10))
show_col(pal_material("indigo", n = 30, alpha = 0.6, reverse = TRUE)(30))

NEJM color palettes

Description

Color palette inspired by plots in The New England Journal of Medicine.

Usage

pal_nejm(palette = c("default"), alpha = 1)

Arguments

palette

Palette type. Currently there is one available option: "default" (8-color palette).

alpha

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

Author(s)

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

Examples

library("scales")
show_col(pal_nejm("default")(8))
show_col(pal_nejm("default", alpha = 0.6)(8))

NPG journal color palettes

Description

Color palettes inspired by plots in journals published by Nature Publishing Group, such as Nature Reviews Cancer.

Usage

pal_npg(palette = c("nrc"), alpha = 1)

Arguments

palette

Palette type. Currently there is one available option: "nrc" (10-color palette inspired by Nature Reviews Cancer).

alpha

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

Author(s)

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

Examples

library("scales")
show_col(pal_npg("nrc")(10))
show_col(pal_npg("nrc", alpha = 0.6)(10))

Observable 10 color palette

Description

The Observable 10 palette.

Usage

pal_observable(palette = c("observable10"), alpha = 1)

Arguments

palette

Palette type. Currently there is one available option: "observable10" (10-color palette).

alpha

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

Author(s)

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

References

Pettiross J (2023). "Crafting data colors and staying on brand." Observable blog. https://observablehq.com/blog/crafting-data-colors

Examples

library("scales")
show_col(pal_observable("observable10")(10))
show_col(pal_observable("observable10", alpha = 0.6)(10))

Rick and Morty color palettes

Description

Color palettes inspired by the colors used in Rick and Morty.

Usage

pal_rickandmorty(palette = c("schwifty"), alpha = 1)

Arguments

palette

Palette type. Currently there is one available option: "schwifty" (12-color palette).

alpha

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

Author(s)

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

Examples

library("scales")
show_col(pal_rickandmorty("schwifty")(12))
show_col(pal_rickandmorty("schwifty", alpha = 0.6)(12))

The Simpsons color palettes

Description

Color palettes inspired by the colors used in The Simpsons.

Usage

pal_simpsons(palette = c("springfield"), alpha = 1)

Arguments

palette

Palette type. Currently there is one available option: "springfield" (16-color palette).

alpha

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

Author(s)

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

Examples

library("scales")
show_col(pal_simpsons("springfield")(16))
show_col(pal_simpsons("springfield", alpha = 0.6)(16))

Star Trek color palettes

Description

Color palettes inspired by the colors used in Star Trek.

Usage

pal_startrek(palette = c("uniform"), alpha = 1)

Arguments

palette

Palette type. Currently there is one available option: "uniform" (7-color palette).

alpha

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

Author(s)

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

Examples

library("scales")
show_col(pal_startrek("uniform")(7))
show_col(pal_startrek("uniform", alpha = 0.6)(7))

Tron Legacy color palettes

Description

Color palettes inspired by the colors used in Tron Legacy.

Usage

pal_tron(palette = c("legacy"), alpha = 1)

Arguments

palette

Palette type. Currently there is one available option: "legacy" (7-color palette).

alpha

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

Author(s)

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

Examples

library("scales")
show_col(pal_tron("legacy")(7))
show_col(pal_tron("legacy", alpha = 0.6)(7))

Tailwind CSS color palettes

Description

Tailwind CSS color palettes.

Usage

pal_tw3(
  palette = c("slate", "gray", "zinc", "neutral", "stone", "red", "orange", "amber",
    "yellow", "lime", "green", "emerald", "teal", "cyan", "sky", "blue", "indigo",
    "violet", "purple", "fuchsia", "pink", "rose"),
  n = 10,
  alpha = 1,
  reverse = FALSE
)

Arguments

palette

Palette type. There are 22 available options:

  • "slate"

  • "gray"

  • "zinc"

  • "neutral"

  • "stone"

  • "red"

  • "orange"

  • "amber"

  • "yellow"

  • "lime"

  • "green"

  • "emerald"

  • "teal"

  • "cyan"

  • "sky"

  • "blue"

  • "indigo"

  • "violet"

  • "purple"

  • "fuchsia"

  • "pink"

  • "rose"

n

Number of individual colors to be generated.

alpha

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

reverse

Logical. Should the order of the colors be reversed?

Author(s)

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

Examples

library("scales")
show_col(pal_tw3("rose")(10))
show_col(pal_tw3("rose", n = 30, alpha = 0.6, reverse = TRUE)(30))

The University of Chicago color palettes

Description

Color palettes based on the colors used by the University of Chicago.

Usage

pal_uchicago(palette = c("default", "light", "dark"), alpha = 1)

Arguments

palette

Palette type. There are three available options:

  • "default" (9-color palette);

  • "light" (9-color light palette);

  • "dark" (9-color dark palette).

alpha

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

Author(s)

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

References

https://news.uchicago.edu/sites/default/files/attachments/_uchicago.identity.guidelines.pdf

Examples

library("scales")
show_col(pal_uchicago("default")(9))
show_col(pal_uchicago("light")(9))
show_col(pal_uchicago("dark")(9))

UCSC Genome Browser color palette

Description

Color palette from UCSC Genome Browser chromosome colors.

Usage

pal_ucscgb(palette = c("default"), alpha = 1)

Arguments

palette

Palette type. Currently there is one available option: "default" (26-color palette).

alpha

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

Author(s)

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

Examples

library("scales")
show_col(pal_ucscgb("default")(26))
show_col(pal_ucscgb("default", alpha = 0.6)(26))

Bootstrap 5 color palettes

Description

Bootstrap 5 color palettes.

Usage

rgb_bs5(
  palette = c("blue", "indigo", "purple", "pink", "red", "orange", "yellow", "green",
    "teal", "cyan", "gray"),
  n = 10,
  alpha = 1,
  reverse = FALSE
)

Arguments

palette

Palette type. There are 11 available options:

  • "blue"

  • "indigo"

  • "purple"

  • "pink"

  • "red"

  • "orange"

  • "yellow"

  • "green"

  • "teal"

  • "cyan"

  • "gray"

n

Number of individual colors to be generated.

alpha

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

reverse

Logical. Should the order of the colors be reversed?

Author(s)

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

References

https://getbootstrap.com/docs/5.3/customize/color/#all-colors

Examples

library("scales")
show_col(pal_bs5("indigo")(10))
show_col(pal_bs5("indigo", n = 30, alpha = 0.6, reverse = TRUE)(30))

The GSEA GenePattern color palettes

Description

Color palette inspired by the colors used in the heatmaps plotted by GSEA GenePattern.

Usage

rgb_gsea(palette = c("default"), n = 12, alpha = 1, reverse = FALSE)

Arguments

palette

Palette type. Currently there is one available option: "default" (continuous palette with 12 base colors).

n

Number of individual colors to be generated.

alpha

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

reverse

Logical. Should the order of the colors be reversed?

Note

The 12 base colors used in this palette are derived from the HeatMapImage documentation.

Author(s)

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

Examples

library("scales")
show_col(pal_gsea("default")(12))
show_col(pal_gsea("default", n = 30, alpha = 0.6, reverse = TRUE)(30))

Material Design color palettes

Description

Material Design 2 color palettes.

Usage

rgb_material(
  palette = c("red", "pink", "purple", "deep-purple", "indigo", "blue", "light-blue",
    "cyan", "teal", "green", "light-green", "lime", "yellow", "amber", "orange",
    "deep-orange", "brown", "grey", "blue-grey"),
  n = 10,
  alpha = 1,
  reverse = FALSE
)

Arguments

palette

Palette type. There are 19 available options:

  • "red"

  • "pink"

  • "purple"

  • "deep-purple"

  • "indigo"

  • "blue"

  • "light-blue"

  • "cyan"

  • "teal"

  • "green"

  • "light-green"

  • "lime"

  • "yellow"

  • "amber"

  • "orange"

  • "deep-orange"

  • "brown"

  • "grey"

  • "blue-grey"

n

Number of individual colors to be generated.

alpha

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

reverse

Logical. Should the order of the colors be reversed?

Author(s)

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

References

https://m2.material.io/design/color/the-color-system.html

Examples

library("scales")
show_col(pal_material("indigo")(10))
show_col(pal_material("indigo", n = 30, alpha = 0.6, reverse = TRUE)(30))

Tailwind CSS color palettes

Description

Tailwind CSS color palettes.

Usage

rgb_tw3(
  palette = c("slate", "gray", "zinc", "neutral", "stone", "red", "orange", "amber",
    "yellow", "lime", "green", "emerald", "teal", "cyan", "sky", "blue", "indigo",
    "violet", "purple", "fuchsia", "pink", "rose"),
  n = 10,
  alpha = 1,
  reverse = FALSE
)

Arguments

palette

Palette type. There are 22 available options:

  • "slate"

  • "gray"

  • "zinc"

  • "neutral"

  • "stone"

  • "red"

  • "orange"

  • "amber"

  • "yellow"

  • "lime"

  • "green"

  • "emerald"

  • "teal"

  • "cyan"

  • "sky"

  • "blue"

  • "indigo"

  • "violet"

  • "purple"

  • "fuchsia"

  • "pink"

  • "rose"

n

Number of individual colors to be generated.

alpha

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

reverse

Logical. Should the order of the colors be reversed?

Author(s)

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

References

https://tailwindcss.com/docs/customizing-colors

Examples

library("scales")
show_col(pal_tw3("rose")(10))
show_col(pal_tw3("rose", n = 30, alpha = 0.6, reverse = TRUE)(30))

AAAS journal color scales

Description

See pal_aaas() for details.

Usage

scale_color_aaas(palette = c("default"), alpha = 1, ...)

scale_colour_aaas(palette = c("default"), alpha = 1, ...)

scale_fill_aaas(palette = c("default"), alpha = 1, ...)

Arguments

palette

Palette type. Currently there is one available option: "default" (10-color palette inspired by Science).

alpha

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

...

Additional parameters for ggplot2::discrete_scale().

Author(s)

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

Examples

library("ggplot2")
data("diamonds")

ggplot(
  subset(diamonds, carat >= 2.2),
  aes(x = table, y = price, colour = cut)
) +
  geom_point(alpha = 0.7) +
  geom_smooth(method = "loess", alpha = 0.1, size = 1, span = 1) +
  theme_bw() +
  scale_color_aaas()

ggplot(
  subset(diamonds, carat > 2.2 & depth > 55 & depth < 70),
  aes(x = depth, fill = cut)
) +
  geom_histogram(colour = "black", binwidth = 1, position = "dodge") +
  theme_bw() +
  scale_fill_aaas()

BMJ color scales

Description

See pal_bmj() for details.

Usage

scale_color_bmj(palette = c("default"), alpha = 1, ...)

scale_colour_bmj(palette = c("default"), alpha = 1, ...)

scale_fill_bmj(palette = c("default"), alpha = 1, ...)

Arguments

palette

Palette type. Currently there is one available option: "default" (9-color palette).

alpha

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

...

Additional parameters for ggplot2::discrete_scale().

Author(s)

Hui Chen | [email protected]

References

https://technology.bmj.com/living-style-guide/colour.html

Examples

library("ggplot2")
data("diamonds")

ggplot(
  subset(diamonds, carat >= 2.2),
  aes(x = table, y = price, colour = cut)
) +
  geom_point(alpha = 0.7) +
  geom_smooth(method = "loess", alpha = 0.1, size = 1, span = 1) +
  theme_bw() +
  scale_color_bmj()

ggplot(
  subset(diamonds, carat > 2.2 & depth > 55 & depth < 70),
  aes(x = depth, fill = cut)
) +
  geom_histogram(colour = "black", binwidth = 1, position = "dodge") +
  theme_bw() +
  scale_fill_bmj()

Bootstrap 5 color scales

Description

See pal_bs5() for details.

Usage

scale_color_bs5(
  palette = c("blue", "indigo", "purple", "pink", "red", "orange", "yellow", "green",
    "teal", "cyan", "gray"),
  alpha = 1,
  reverse = FALSE,
  ...
)

scale_colour_bs5(
  palette = c("blue", "indigo", "purple", "pink", "red", "orange", "yellow", "green",
    "teal", "cyan", "gray"),
  alpha = 1,
  reverse = FALSE,
  ...
)

scale_fill_bs5(
  palette = c("blue", "indigo", "purple", "pink", "red", "orange", "yellow", "green",
    "teal", "cyan", "gray"),
  alpha = 1,
  reverse = FALSE,
  ...
)

Arguments

palette

Palette type. There are 11 available options:

  • "blue"

  • "indigo"

  • "purple"

  • "pink"

  • "red"

  • "orange"

  • "yellow"

  • "green"

  • "teal"

  • "cyan"

  • "gray"

alpha

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

reverse

Logical. Should the order of the colors be reversed?

...

Additional parameters for ggplot2::discrete_scale().

Author(s)

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

Examples

library("ggplot2")

data("mtcars")
cor <- abs(cor(mtcars))
cor_melt <- data.frame(
  Var1 = rep(seq_len(nrow(cor)), times = ncol(cor)),
  Var2 = rep(seq_len(ncol(cor)), each = nrow(cor)),
  value = as.vector(cor)
)

ggplot(
  cor_melt,
  aes(x = Var1, y = Var2, fill = value)
) +
  geom_tile(colour = "black", size = 0.3) +
  theme_bw() +
  scale_fill_bs5("teal")

COSMIC color scales

Description

See pal_cosmic() for details.

Usage

scale_color_cosmic(
  palette = c("hallmarks_light", "hallmarks_dark", "signature_substitutions"),
  alpha = 1,
  ...
)

scale_colour_cosmic(
  palette = c("hallmarks_light", "hallmarks_dark", "signature_substitutions"),
  alpha = 1,
  ...
)

scale_fill_cosmic(
  palette = c("hallmarks_light", "hallmarks_dark", "signature_substitutions"),
  alpha = 1,
  ...
)

Arguments

palette

Palette type. Currently there are three available options:

  • "signature_substitutions" (6-color palette).

  • "hallmarks_light" (10-color palette).

  • "hallmarks_dark" (10-color palette).

The "hallmarks_light" option is from Hanahan and Weinberg (2011).

alpha

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

...

Additional parameters for ggplot2::discrete_scale().

Author(s)

Joshua H. Cook | [email protected] | @jhrcook

Examples

library("ggplot2")
data("diamonds")

ggplot(
  subset(diamonds, carat >= 2.2),
  aes(x = table, y = price, colour = cut)
) +
  geom_point(alpha = 0.7) +
  geom_smooth(method = "loess", alpha = 0.1, size = 1, span = 1) +
  theme_bw() +
  scale_color_cosmic()

ggplot(
  subset(diamonds, carat > 2.2 & depth > 55 & depth < 70),
  aes(x = depth, fill = cut)
) +
  geom_histogram(colour = "black", binwidth = 1, position = "dodge") +
  theme_bw() +
  scale_fill_cosmic()

D3.js color scales

Description

See pal_d3() for details.

Usage

scale_color_d3(
  palette = c("category10", "category20", "category20b", "category20c"),
  alpha = 1,
  ...
)

scale_colour_d3(
  palette = c("category10", "category20", "category20b", "category20c"),
  alpha = 1,
  ...
)

scale_fill_d3(
  palette = c("category10", "category20", "category20b", "category20c"),
  alpha = 1,
  ...
)

Arguments

palette

Palette type. There are four 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 grDevices::rgb() for details.

...

Additional parameters for ggplot2::discrete_scale().

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

library("ggplot2")
data("diamonds")

p1 <- ggplot(
  subset(diamonds, carat >= 2.2),
  aes(x = table, y = price, colour = cut)
) +
  geom_point(alpha = 0.7) +
  geom_smooth(method = "loess", alpha = 0.1, size = 1, span = 1) +
  theme_bw()

p2 <- ggplot(
  subset(diamonds, carat > 2.2 & depth > 55 & depth < 70),
  aes(x = depth, fill = cut)
) +
  geom_histogram(colour = "black", binwidth = 1, position = "dodge") +
  theme_bw()

p1 + scale_color_d3()
p2 + scale_fill_d3()

p1 + scale_color_d3(palette = "category20")
p2 + scale_fill_d3(palette = "category20")

p1 + scale_color_d3(palette = "category20b")
p2 + scale_fill_d3(palette = "category20b")

p1 + scale_color_d3(palette = "category20c")
p2 + scale_fill_d3(palette = "category20c")

Flat UI color scales

Description

See pal_flatui() for details.

Usage

scale_color_flatui(
  palette = c("default", "flattastic", "aussie"),
  alpha = 1,
  ...
)

scale_colour_flatui(
  palette = c("default", "flattastic", "aussie"),
  alpha = 1,
  ...
)

scale_fill_flatui(
  palette = c("default", "flattastic", "aussie"),
  alpha = 1,
  ...
)

Arguments

palette

Palette type. Currently there are three available options:

  • "default" (10-color palette).

  • "flattastic" (12-color palette).

  • "aussie" (10-color palette).

alpha

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

...

Additional parameters for ggplot2::discrete_scale().

Author(s)

Clara Jégousse | [email protected]

Examples

library("ggplot2")
data("diamonds")

p1 <- ggplot(
  subset(diamonds, carat >= 2.2),
  aes(x = table, y = price, colour = cut)
) +
  geom_point(alpha = 0.7) +
  geom_smooth(method = "loess", alpha = 0.1, size = 1, span = 1) +
  theme_bw()

p2 <- ggplot(
  subset(diamonds, carat > 2.2 & depth > 55 & depth < 70),
  aes(x = depth, fill = cut)
) +
  geom_histogram(colour = "black", binwidth = 1, position = "dodge") +
  theme_bw()

p1 + scale_color_flatui()
p2 + scale_fill_flatui()

p1 + scale_color_flatui(palette = "default")
p2 + scale_fill_flatui(palette = "default")

p1 + scale_color_flatui(palette = "flattastic")
p2 + scale_fill_flatui(palette = "flattastic")

p1 + scale_color_flatui(palette = "aussie")
p2 + scale_fill_flatui(palette = "aussie")

Frontiers journal color scales

Description

See pal_frontiers() for details.

Usage

scale_color_frontiers(palette = c("default"), alpha = 1, ...)

scale_colour_frontiers(palette = c("default"), alpha = 1, ...)

scale_fill_frontiers(palette = c("default"), alpha = 1, ...)

Arguments

palette

Palette type. Currently there is one available option: "default" (10-color palette).

alpha

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

...

Additional parameters for ggplot2::discrete_scale().

Author(s)

Clara Jégousse | [email protected]

Examples

library("ggplot2")
data("diamonds")

ggplot(
  subset(diamonds, carat >= 2.2),
  aes(x = table, y = price, colour = cut)
) +
  geom_point(alpha = 0.7) +
  geom_smooth(method = "loess", alpha = 0.1, size = 1, span = 1) +
  theme_dark() +
  theme(
    panel.background = element_rect(fill = "#2D2D2D"),
    legend.key = element_rect(fill = "#2D2D2D")
  ) +
  scale_color_frontiers()

ggplot(
  subset(diamonds, carat > 2.2 & depth > 55 & depth < 70),
  aes(x = depth, fill = cut)
) +
  geom_histogram(colour = "black", binwidth = 1, position = "dodge") +
  theme_dark() +
  theme(
    panel.background = element_rect(fill = "#2D2D2D")
  ) +
  scale_fill_frontiers()

Futurama color scales

Description

See pal_futurama() for details.

Usage

scale_color_futurama(palette = c("planetexpress"), alpha = 1, ...)

scale_colour_futurama(palette = c("planetexpress"), alpha = 1, ...)

scale_fill_futurama(palette = c("planetexpress"), alpha = 1, ...)

Arguments

palette

Palette type. Currently there is one available option: "planetexpress" (12-color palette).

alpha

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

...

Additional parameters for ggplot2::discrete_scale().

Author(s)

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

Examples

library("ggplot2")
data("diamonds")

ggplot(
  subset(diamonds, carat >= 2.2),
  aes(x = table, y = price, colour = cut)
) +
  geom_point(alpha = 0.7) +
  geom_smooth(method = "loess", alpha = 0.1, size = 1, span = 1) +
  theme_bw() +
  scale_color_futurama()

ggplot(
  subset(diamonds, carat > 2.2 & depth > 55 & depth < 70),
  aes(x = depth, fill = cut)
) +
  geom_histogram(colour = "black", binwidth = 1, position = "dodge") +
  theme_bw() +
  scale_fill_futurama()

The GSEA GenePattern color scales

Description

See pal_gsea() for details.

Usage

scale_color_gsea(palette = c("default"), alpha = 1, reverse = FALSE, ...)

scale_colour_gsea(palette = c("default"), alpha = 1, reverse = FALSE, ...)

scale_fill_gsea(palette = c("default"), alpha = 1, reverse = FALSE, ...)

Arguments

palette

Palette type. Currently there is one available option: "default" (continuous palette with 12 base colors).

alpha

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

reverse

Logical. Should the order of the colors be reversed?

...

Additional parameters for ggplot2::discrete_scale().

Author(s)

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

Examples

library("ggplot2")

data("mtcars")
cor <- cor(mtcars)
cor_melt <- data.frame(
  Var1 = rep(seq_len(nrow(cor)), times = ncol(cor)),
  Var2 = rep(seq_len(ncol(cor)), each = nrow(cor)),
  value = as.vector(cor)
)

ggplot(
  cor_melt,
  aes(x = Var1, y = Var2, fill = value)
) +
  geom_tile(colour = "black", size = 0.3) +
  theme_bw() +
  scale_fill_gsea()

Integrative Genomics Viewer (IGV) color scales

Description

See pal_igv() for details.

Usage

scale_color_igv(palette = c("default", "alternating"), alpha = 1, ...)

scale_colour_igv(palette = c("default", "alternating"), alpha = 1, ...)

scale_fill_igv(palette = c("default", "alternating"), alpha = 1, ...)

Arguments

palette

Palette type. There are two available options:

  • "default" (51-color palette).

  • "alternating" (2-color palette).

alpha

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

...

Additional parameters for ggplot2::discrete_scale().

Author(s)

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

Examples

library("ggplot2")
data("diamonds")

p1 <- ggplot(
  subset(diamonds, carat >= 2.2),
  aes(x = table, y = price, colour = cut)
) +
  geom_point(alpha = 0.7) +
  geom_smooth(method = "loess", alpha = 0.1, size = 1, span = 1) +
  theme_bw()

p2 <- ggplot(
  subset(diamonds, carat > 2.2 & depth > 55 & depth < 70),
  aes(x = depth, fill = cut)
) +
  geom_histogram(colour = "black", binwidth = 1, position = "dodge") +
  theme_bw()

p1 + scale_color_igv()
p2 + scale_fill_igv()

p1 + scale_colour_manual(
  values = rep(pal_igv("alternating")(2), times = 3)
)
p2 + scale_fill_manual(
  values = rep(pal_igv("alternating")(2), times = 3)
)

Journal of the American Medical Association color scales

Description

See pal_jama() for details.

Usage

scale_color_jama(palette = c("default"), alpha = 1, ...)

scale_colour_jama(palette = c("default"), alpha = 1, ...)

scale_fill_jama(palette = c("default"), alpha = 1, ...)

Arguments

palette

Palette type. Currently there is one available option: "default" (7-color palette).

alpha

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

...

Additional parameters for ggplot2::discrete_scale().

Author(s)

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

Examples

library("ggplot2")
data("diamonds")

ggplot(
  subset(diamonds, carat >= 2.2),
  aes(x = table, y = price, colour = cut)
) +
  geom_point(alpha = 0.7) +
  geom_smooth(method = "loess", alpha = 0.1, size = 1, span = 1) +
  theme_bw() +
  scale_color_jama()

ggplot(
  subset(diamonds, carat > 2.2 & depth > 55 & depth < 70),
  aes(x = depth, fill = cut)
) +
  geom_histogram(colour = "black", binwidth = 1, position = "dodge") +
  theme_bw() +
  scale_fill_jama()

Journal of Clinical Oncology color scales

Description

See pal_jco() for details.

Usage

scale_color_jco(palette = c("default"), alpha = 1, ...)

scale_colour_jco(palette = c("default"), alpha = 1, ...)

scale_fill_jco(palette = c("default"), alpha = 1, ...)

Arguments

palette

Palette type. Currently there is one available option: "default" (10-color palette).

alpha

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

...

Additional parameters for ggplot2::discrete_scale().

Author(s)

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

Examples

library("ggplot2")
data("diamonds")

ggplot(
  subset(diamonds, carat >= 2.2),
  aes(x = table, y = price, colour = cut)
) +
  geom_point(alpha = 0.7) +
  geom_smooth(method = "loess", alpha = 0.1, size = 1, span = 1) +
  theme_bw() +
  scale_color_jco()

ggplot(
  subset(diamonds, carat > 2.2 & depth > 55 & depth < 70),
  aes(x = depth, fill = cut)
) +
  geom_histogram(colour = "black", binwidth = 1, position = "dodge") +
  theme_bw() +
  scale_fill_jco()

Lancet journal color scales

Description

See pal_lancet() for details.

Usage

scale_color_lancet(palette = c("lanonc"), alpha = 1, ...)

scale_colour_lancet(palette = c("lanonc"), alpha = 1, ...)

scale_fill_lancet(palette = c("lanonc"), alpha = 1, ...)

Arguments

palette

Palette type. Currently there is one available option: "lanonc" (9-color palette inspired by Lancet Oncology).

alpha

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

...

Additional parameters for ggplot2::discrete_scale().

Author(s)

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

Examples

library("ggplot2")
data("diamonds")

ggplot(
  subset(diamonds, carat >= 2.2),
  aes(x = table, y = price, colour = cut)
) +
  geom_point(alpha = 0.7) +
  geom_smooth(method = "loess", alpha = 0.1, size = 1, span = 1) +
  theme_bw() +
  scale_color_lancet()

ggplot(
  subset(diamonds, carat > 2.2 & depth > 55 & depth < 70),
  aes(x = depth, fill = cut)
) +
  geom_histogram(colour = "black", binwidth = 1, position = "dodge") +
  theme_bw() +
  scale_fill_lancet()

LocusZoom color scales

Description

See pal_locuszoom() for details.

Usage

scale_color_locuszoom(palette = c("default"), alpha = 1, ...)

scale_colour_locuszoom(palette = c("default"), alpha = 1, ...)

scale_fill_locuszoom(palette = c("default"), alpha = 1, ...)

Arguments

palette

Palette type. Currently there is one available option: "default" (7-color palette).

alpha

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

...

Additional parameters for ggplot2::discrete_scale().

Author(s)

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

Examples

library("ggplot2")
data("diamonds")

ggplot(
  subset(diamonds, carat >= 2.2),
  aes(x = table, y = price, colour = cut)
) +
  geom_point(alpha = 0.7) +
  geom_smooth(method = "loess", alpha = 0.1, size = 1, span = 1) +
  theme_bw() +
  scale_color_locuszoom()

ggplot(
  subset(diamonds, carat > 2.2 & depth > 55 & depth < 70),
  aes(x = depth, fill = cut)
) +
  geom_histogram(colour = "black", binwidth = 1, position = "dodge") +
  theme_bw() +
  scale_fill_locuszoom()

Material Design color scales

Description

See pal_material() for details.

Usage

scale_color_material(
  palette = c("red", "pink", "purple", "deep-purple", "indigo", "blue", "light-blue",
    "cyan", "teal", "green", "light-green", "lime", "yellow", "amber", "orange",
    "deep-orange", "brown", "grey", "blue-grey"),
  alpha = 1,
  reverse = FALSE,
  ...
)

scale_colour_material(
  palette = c("red", "pink", "purple", "deep-purple", "indigo", "blue", "light-blue",
    "cyan", "teal", "green", "light-green", "lime", "yellow", "amber", "orange",
    "deep-orange", "brown", "grey", "blue-grey"),
  alpha = 1,
  reverse = FALSE,
  ...
)

scale_fill_material(
  palette = c("red", "pink", "purple", "deep-purple", "indigo", "blue", "light-blue",
    "cyan", "teal", "green", "light-green", "lime", "yellow", "amber", "orange",
    "deep-orange", "brown", "grey", "blue-grey"),
  alpha = 1,
  reverse = FALSE,
  ...
)

Arguments

palette

Palette type. There are 19 available options:

  • "red"

  • "pink"

  • "purple"

  • "deep-purple"

  • "indigo"

  • "blue"

  • "light-blue"

  • "cyan"

  • "teal"

  • "green"

  • "light-green"

  • "lime"

  • "yellow"

  • "amber"

  • "orange"

  • "deep-orange"

  • "brown"

  • "grey"

  • "blue-grey"

alpha

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

reverse

Logical. Should the order of the colors be reversed?

...

Additional parameters for ggplot2::discrete_scale().

Author(s)

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

Examples

library("ggplot2")

data("mtcars")
cor <- abs(cor(mtcars))
cor_melt <- data.frame(
  Var1 = rep(seq_len(nrow(cor)), times = ncol(cor)),
  Var2 = rep(seq_len(ncol(cor)), each = nrow(cor)),
  value = as.vector(cor)
)

ggplot(
  cor_melt,
  aes(x = Var1, y = Var2, fill = value)
) +
  geom_tile(colour = "black", size = 0.3) +
  theme_bw() +
  scale_fill_material("blue-grey")

NEJM color scales

Description

See pal_nejm() for details.

Usage

scale_color_nejm(palette = c("default"), alpha = 1, ...)

scale_colour_nejm(palette = c("default"), alpha = 1, ...)

scale_fill_nejm(palette = c("default"), alpha = 1, ...)

Arguments

palette

Palette type. Currently there is one available option: "default" (8-color palette).

alpha

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

...

Additional parameters for ggplot2::discrete_scale().

Author(s)

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

Examples

library("ggplot2")
data("diamonds")

ggplot(
  subset(diamonds, carat >= 2.2),
  aes(x = table, y = price, colour = cut)
) +
  geom_point(alpha = 0.7) +
  geom_smooth(method = "loess", alpha = 0.1, size = 1, span = 1) +
  theme_bw() +
  scale_color_nejm()

ggplot(
  subset(diamonds, carat > 2.2 & depth > 55 & depth < 70),
  aes(x = depth, fill = cut)
) +
  geom_histogram(colour = "black", binwidth = 1, position = "dodge") +
  theme_bw() +
  scale_fill_nejm()

NPG journal color scales

Description

See pal_npg() for details.

Usage

scale_color_npg(palette = c("nrc"), alpha = 1, ...)

scale_colour_npg(palette = c("nrc"), alpha = 1, ...)

scale_fill_npg(palette = c("nrc"), alpha = 1, ...)

Arguments

palette

Palette type. Currently there is one available option: "nrc" (10-color palette inspired by Nature Reviews Cancer).

alpha

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

...

Additional parameters for ggplot2::discrete_scale().

Author(s)

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

Examples

library("ggplot2")
data("diamonds")

ggplot(
  subset(diamonds, carat >= 2.2),
  aes(x = table, y = price, colour = cut)
) +
  geom_point(alpha = 0.7) +
  geom_smooth(method = "loess", alpha = 0.1, size = 1, span = 1) +
  theme_bw() +
  scale_color_npg()

ggplot(
  subset(diamonds, carat > 2.2 & depth > 55 & depth < 70),
  aes(x = depth, fill = cut)
) +
  geom_histogram(colour = "black", binwidth = 1, position = "dodge") +
  theme_bw() +
  scale_fill_npg()

Observable 10 color scales

Description

See pal_observable() for details.

Usage

scale_color_observable(palette = c("observable10"), alpha = 1, ...)

scale_colour_observable(palette = c("observable10"), alpha = 1, ...)

scale_fill_observable(palette = c("observable10"), alpha = 1, ...)

Arguments

palette

Palette type. Currently there is one available option: "observable10" (10-color palette).

alpha

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

...

Additional parameters for ggplot2::discrete_scale().

Author(s)

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

References

Pettiross J (2023). "Crafting data colors and staying on brand." Observable blog. https://observablehq.com/blog/crafting-data-colors

Examples

library("ggplot2")
data("diamonds")

ggplot(
  subset(diamonds, carat >= 2.2),
  aes(x = table, y = price, colour = cut)
) +
  geom_point(alpha = 0.7) +
  geom_smooth(method = "loess", alpha = 0.1, size = 1, span = 1) +
  theme_bw() +
  scale_color_observable()

ggplot(
  subset(diamonds, carat > 2.2 & depth > 55 & depth < 70),
  aes(x = depth, fill = cut)
) +
  geom_histogram(colour = "black", binwidth = 1, position = "dodge") +
  theme_bw() +
  scale_fill_observable()

Rick and Morty color scales

Description

See pal_rickandmorty() for details.

Usage

scale_color_rickandmorty(palette = c("schwifty"), alpha = 1, ...)

scale_colour_rickandmorty(palette = c("schwifty"), alpha = 1, ...)

scale_fill_rickandmorty(palette = c("schwifty"), alpha = 1, ...)

Arguments

palette

Palette type. Currently there is one available option: "schwifty" (12-color palette).

alpha

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

...

Additional parameters for ggplot2::discrete_scale().

Author(s)

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

Examples

library("ggplot2")
data("diamonds")

ggplot(
  subset(diamonds, carat >= 2.2),
  aes(x = table, y = price, colour = cut)
) +
  geom_point(alpha = 0.7) +
  geom_smooth(method = "loess", alpha = 0.1, size = 1, span = 1) +
  theme_bw() +
  scale_color_rickandmorty()

ggplot(
  subset(diamonds, carat > 2.2 & depth > 55 & depth < 70),
  aes(x = depth, fill = cut)
) +
  geom_histogram(colour = "black", binwidth = 1, position = "dodge") +
  theme_bw() +
  scale_fill_rickandmorty()

The Simpsons color scales

Description

See pal_simpsons() for details.

Usage

scale_color_simpsons(palette = c("springfield"), alpha = 1, ...)

scale_colour_simpsons(palette = c("springfield"), alpha = 1, ...)

scale_fill_simpsons(palette = c("springfield"), alpha = 1, ...)

Arguments

palette

Palette type. Currently there is one available option: "springfield" (16-color palette).

alpha

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

...

Additional parameters for ggplot2::discrete_scale().

Author(s)

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

Examples

library("ggplot2")
data("diamonds")

ggplot(
  subset(diamonds, carat >= 2.2),
  aes(x = table, y = price, colour = cut)
) +
  geom_point(alpha = 0.7) +
  geom_smooth(method = "loess", alpha = 0.1, size = 1, span = 1) +
  theme_bw() +
  scale_color_simpsons()

ggplot(
  subset(diamonds, carat > 2.2 & depth > 55 & depth < 70),
  aes(x = depth, fill = cut)
) +
  geom_histogram(colour = "black", binwidth = 1, position = "dodge") +
  theme_bw() +
  scale_fill_simpsons()

Star Trek color scales

Description

See pal_startrek() for details.

Usage

scale_color_startrek(palette = c("uniform"), alpha = 1, ...)

scale_colour_startrek(palette = c("uniform"), alpha = 1, ...)

scale_fill_startrek(palette = c("uniform"), alpha = 1, ...)

Arguments

palette

Palette type. Currently there is one available option: "uniform" (7-color palette).

alpha

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

...

Additional parameters for ggplot2::discrete_scale().

Author(s)

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

Examples

library("ggplot2")
data("diamonds")

ggplot(
  subset(diamonds, carat >= 2.2),
  aes(x = table, y = price, colour = cut)
) +
  geom_point(alpha = 0.7) +
  geom_smooth(method = "loess", alpha = 0.1, size = 1, span = 1) +
  theme_bw() +
  scale_color_startrek()

ggplot(
  subset(diamonds, carat > 2.2 & depth > 55 & depth < 70),
  aes(x = depth, fill = cut)
) +
  geom_histogram(colour = "black", binwidth = 1, position = "dodge") +
  theme_bw() +
  scale_fill_startrek()

Tron Legacy color scales

Description

See pal_tron() for details.

Usage

scale_color_tron(palette = c("legacy"), alpha = 1, ...)

scale_colour_tron(palette = c("legacy"), alpha = 1, ...)

scale_fill_tron(palette = c("legacy"), alpha = 1, ...)

Arguments

palette

Palette type. Currently there is one available option: "legacy" (7-color palette).

alpha

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

...

Additional parameters for ggplot2::discrete_scale().

Author(s)

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

Examples

library("ggplot2")
data("diamonds")

ggplot(
  subset(diamonds, carat >= 2.2),
  aes(x = table, y = price, colour = cut)
) +
  geom_point(alpha = 0.7) +
  geom_smooth(method = "loess", alpha = 0.1, size = 1, span = 1) +
  theme_dark() +
  theme(
    panel.background = element_rect(fill = "#2D2D2D"),
    legend.key = element_rect(fill = "#2D2D2D")
  ) +
  scale_color_tron()

ggplot(
  subset(diamonds, carat > 2.2 & depth > 55 & depth < 70),
  aes(x = depth, fill = cut)
) +
  geom_histogram(colour = "black", binwidth = 1, position = "dodge") +
  theme_dark() +
  theme(
    panel.background = element_rect(fill = "#2D2D2D")
  ) +
  scale_fill_tron()

Tailwind CSS color scales

Description

See pal_tw3() for details.

Usage

scale_color_tw3(
  palette = c("slate", "gray", "zinc", "neutral", "stone", "red", "orange", "amber",
    "yellow", "lime", "green", "emerald", "teal", "cyan", "sky", "blue", "indigo",
    "violet", "purple", "fuchsia", "pink", "rose"),
  alpha = 1,
  reverse = FALSE,
  ...
)

scale_colour_tw3(
  palette = c("slate", "gray", "zinc", "neutral", "stone", "red", "orange", "amber",
    "yellow", "lime", "green", "emerald", "teal", "cyan", "sky", "blue", "indigo",
    "violet", "purple", "fuchsia", "pink", "rose"),
  alpha = 1,
  reverse = FALSE,
  ...
)

scale_fill_tw3(
  palette = c("slate", "gray", "zinc", "neutral", "stone", "red", "orange", "amber",
    "yellow", "lime", "green", "emerald", "teal", "cyan", "sky", "blue", "indigo",
    "violet", "purple", "fuchsia", "pink", "rose"),
  alpha = 1,
  reverse = FALSE,
  ...
)

Arguments

palette

Palette type. There are 22 available options:

  • "slate"

  • "gray"

  • "zinc"

  • "neutral"

  • "stone"

  • "red"

  • "orange"

  • "amber"

  • "yellow"

  • "lime"

  • "green"

  • "emerald"

  • "teal"

  • "cyan"

  • "sky"

  • "blue"

  • "indigo"

  • "violet"

  • "purple"

  • "fuchsia"

  • "pink"

  • "rose"

alpha

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

reverse

Logical. Should the order of the colors be reversed?

...

Additional parameters for ggplot2::discrete_scale().

Author(s)

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

Examples

library("ggplot2")

data("mtcars")
cor <- abs(cor(mtcars))
cor_melt <- data.frame(
  Var1 = rep(seq_len(nrow(cor)), times = ncol(cor)),
  Var2 = rep(seq_len(ncol(cor)), each = nrow(cor)),
  value = as.vector(cor)
)

ggplot(
  cor_melt,
  aes(x = Var1, y = Var2, fill = value)
) +
  geom_tile(colour = "black", size = 0.3) +
  theme_bw() +
  scale_fill_tw3("slate")

The University of Chicago color scales

Description

See pal_uchicago() for details.

Usage

scale_color_uchicago(palette = c("default", "light", "dark"), alpha = 1, ...)

scale_colour_uchicago(palette = c("default", "light", "dark"), alpha = 1, ...)

scale_fill_uchicago(palette = c("default", "light", "dark"), alpha = 1, ...)

Arguments

palette

Palette type. There are three available options:

  • "default" (9-color palette);

  • "light" (9-color light palette);

  • "dark" (9-color dark palette).

alpha

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

...

Additional parameters for ggplot2::discrete_scale().

Author(s)

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

References

https://news.uchicago.edu/sites/default/files/attachments/_uchicago.identity.guidelines.pdf

Examples

library("ggplot2")
data("diamonds")

p1 <- ggplot(
  subset(diamonds, carat >= 2.2),
  aes(x = table, y = price, colour = cut)
) +
  geom_point(alpha = 0.7) +
  geom_smooth(method = "loess", alpha = 0.1, size = 1, span = 1) +
  theme_bw()

p2 <- ggplot(
  subset(diamonds, carat > 2.2 & depth > 55 & depth < 70),
  aes(x = depth, fill = cut)
) +
  geom_histogram(colour = "black", binwidth = 1, position = "dodge") +
  theme_bw()

p1 + scale_color_uchicago()
p2 + scale_fill_uchicago()

p1 + scale_color_uchicago(palette = "light")
p2 + scale_fill_uchicago(palette = "light")

p1 + scale_color_uchicago(palette = "dark")
p2 + scale_fill_uchicago(palette = "dark")

UCSC Genome Browser color scales

Description

See pal_ucscgb() for details.

Usage

scale_color_ucscgb(palette = c("default"), alpha = 1, ...)

scale_colour_ucscgb(palette = c("default"), alpha = 1, ...)

scale_fill_ucscgb(palette = c("default"), alpha = 1, ...)

Arguments

palette

Palette type. Currently there is one available option: "default" (26-color palette).

alpha

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

...

Additional parameters for ggplot2::discrete_scale().

Author(s)

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

Examples

library("ggplot2")
data("diamonds")

ggplot(
  subset(diamonds, carat >= 2.2),
  aes(x = table, y = price, colour = cut)
) +
  geom_point(alpha = 0.7) +
  geom_smooth(method = "loess", alpha = 0.1, size = 1, span = 1) +
  theme_bw() +
  scale_color_ucscgb()

ggplot(
  subset(diamonds, carat > 2.2 & depth > 55 & depth < 70),
  aes(x = depth, fill = cut)
) +
  geom_histogram(colour = "black", binwidth = 1, position = "dodge") +
  theme_bw() +
  scale_fill_ucscgb()