ggsci/0000755000176200001440000000000013276211255011352 5ustar liggesusersggsci/TODO0000644000176200001440000000136113221611720012032 0ustar liggesusers# TODO - Okabe, Masataka and Kei Ito's Color Universal Design (CUD) for color blindness: http://jfly.iam.u-tokyo.ac.jp/color/ https://www.chronicle.com/blogs/profhacker/color-blind-accessible-figures/59189 https://www.nature.com/articles/nmeth.1618 - Marvel's The Defenders (colors from opening titles). Red - Daredevil; Blue - Jessica Jones; Orange - Luke Cage; Green - Iron Fist. - Gephi: https://github.com/gephi/gephi/blob/master/modules/Utils/src/main/java/org/gephi/utils/PaletteUtils.java#L83-L110 - Apple Human Interface Guidelines: https://developer.apple.com/ios/human-interface-guidelines/visual-design/color/ one discrete, one continuous. - Add a function for displaying all color palettes - Color palette extraction: http://colormind.io/ ggsci/inst/0000755000176200001440000000000013276174761012341 5ustar liggesusersggsci/inst/doc/0000755000176200001440000000000013276174761013106 5ustar liggesusersggsci/inst/doc/ggsci.html0000644000176200001440001725771513276174761015121 0ustar liggesusers Scientific Journal and Sci-Fi Themed Color Palettes for ggplot2

Scientific Journal and Sci-Fi Themed
Color Palettes for ggplot2

Nan Xiao <https://nanx.me>
Miaozhu Li <http://miaozhu.li>

2018-05-13

1 Introduction

My eyes were finally opened and I understood nature.

I learned at the same time to love it.

— Claude Monet

ggsci offers a collection of high-quality color palettes inspired by colors used in scientific journals, data visualization libraries, science fiction movies, and TV shows. The color palettes in ggsci are available as ggplot2 scales. For all the color palettes, the corresponding scales are named as:

We also provided aliases, such as scale_colour_palname() for scale_color_palname(). All available color palettes are summarized in the table below.

Name Scales Palette Types Palette Generator
NPG scale_color_npg() scale_fill_npg() "nrc" pal_npg()
AAAS scale_color_aaas() scale_fill_aaas() "default" pal_aaas()
NEJM scale_color_nejm() scale_fill_nejm() "default" pal_nejm()
Lancet scale_color_lancet() scale_fill_lancet() "lanonc" pal_lancet()
JAMA scale_color_jama() scale_fill_jama() "default" pal_jama()
JCO scale_color_jco() scale_fill_jco() "default" pal_jco()
UCSCGB scale_color_ucscgb() scale_fill_ucscgb() "default" pal_ucscgb()
D3 scale_color_d3()
scale_fill_d3()
"category10" "category20" "category20b" "category20c" pal_d3()
LocusZoom scale_color_locuszoom() scale_fill_locuszoom() "default" pal_locuszoom()
IGV scale_color_igv() scale_fill_igv() "default"
"alternating"
pal_igv()
UChicago scale_color_uchicago() scale_fill_uchicago() "default"
"light"
"dark"
pal_uchicago()
Star Trek scale_color_startrek() scale_fill_startrek() "uniform" pal_startrek()
Tron Legacy scale_color_tron() scale_fill_tron() "legacy" pal_tron()
Futurama scale_color_futurama() scale_fill_futurama() "planetexpress" pal_futurama()
Rick and Morty scale_color_rickandmorty() scale_fill_rickandmorty() "schwifty" pal_rickandmorty()
The Simpsons scale_color_simpsons() scale_fill_simpsons() "springfield" pal_simpsons()
GSEA scale_color_gsea() scale_fill_gsea() "default" pal_gsea()
Material Design scale_color_material() scale_fill_material() "red" "pink"
"purple" "deep-purple"
"indigo" "blue"
"light-blue" "cyan"
"teal" "green"
"light-green" "lime"
"yellow" "amber"
"orange" "deep-orange"
"brown" "grey"
"blue-grey"
pal_material()

2 Discrete Color Palettes

We will use scatterplots with smooth curves, and bar plots to demonstrate the discrete color palettes in ggsci.

library("ggsci")
library("ggplot2")
library("gridExtra")

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.05, 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()

2.1 NPG

The NPG palette is inspired by the plots in the journals published by Nature Publishing Group:

2.2 AAAS

The AAAS palette is inspired by the plots in the journals published by American Association for the Advancement of Science:

2.3 NEJM

The NEJM palette is inspired by the plots in The New England Journal of Medicine:

2.4 Lancet

The Lancet palette is inspired by the plots in Lancet journals, such as Lancet Oncology:

2.5 JAMA

The JAMA palette is inspired by the plots in The Journal of the American Medical Association:

2.6 JCO

The JCO palette is inspired by the the plots in Journal of Clinical Oncology:

2.7 UCSCGB

The UCSCGB palette is from the colors used by UCSC Genome Browser for representing chromosomes. This palette has been intensively used in visualizations produced by Circos.

2.8 D3

The D3 palette is from the categorical colors used by D3.js (version 3.x and before). There are four palette types (category10, category20, category20b, category20c) available.

2.9 LocusZoom

The LocusZoom palette is based on the colors used by LocusZoom.

2.10 IGV

The IGV palette is from the colors used by Integrative Genomics Viewer for representing chromosomes. There are two palette types (default, alternating) available.

2.11 UChicago

The UChicago palette is based on the colors used by the University of Chicago. There are three palette types (default, light, dark) available.

2.12 Star Trek

This palette is inspired by the (uniform) colors in Star Trek:

2.13 Tron Legacy

This palette is inspired by the colors used in Tron Legacy. It is suitable for displaying data when using a dark theme:

2.14 Futurama

This palette is inspired by the colors used in the TV show Futurama:

2.15 Rick and Morty

This palette is inspired by the colors used in the TV show Rick and Morty:

2.16 The Simpsons

This palette is inspired by the colors used in the TV show The Simpsons:

3 Continuous Color Palettes

We will use a correlation matrix visualization (a special type of heatmap) to demonstrate the continuous color palettes in ggsci.

library("reshape2")

data("mtcars")
cor = cor(unname(cbind(mtcars, mtcars, mtcars, mtcars)))
cor_melt = melt(cor)

p3 = ggplot(cor_melt,
            aes(x = Var1, y = Var2, fill = value)) +
  geom_tile(colour = "black", size = 0.3) +
  theme_bw() +
  theme(axis.title.x = element_blank(),
        axis.title.y = element_blank())

3.1 GSEA

The GSEA palette (continuous) is inspired by the heatmaps generated by GSEA GenePattern.

3.2 Material Design

The Material Design color palettes are from the material design color guidelines.

We generate a random matrix first:

Plot the matrix with the 19 material design color palettes:

From the figure above, we can see that even though an identical matrix was visualized by all plots, some palettes are more preferrable than the others because our eyes are more sensitive to the changes of their saturation levels.

4 Non-ggplot2 Graphics

To apply the color palettes in ggsci to other graphics systems (such as base graphics and lattice graphics), simply use the palette generator functions in the table above. For example:

mypal = pal_npg("nrc", alpha = 0.7)(9)
mypal
## [1] "#E64B35B2" "#4DBBD5B2" "#00A087B2" "#3C5488B2" "#F39B7FB2" "#8491B4B2"
## [7] "#91D1C2B2" "#DC0000B2" "#7E6148B2"
library("scales")
show_col(mypal)

You will be able to use the generated hex color codes for such graphics systems accordingly. The transparent level of the entire palette is easily adjustable via the argument "alpha" in every generator or scale function.

5 Discussion

Please note some of the palettes might not be the best choice for certain purposes, such as color-blind safe, photocopy safe, or print friendly. If you do have such considerations, you might want to check out color palettes like ColorBrewer and viridis.

The color palettes in this package are solely created for research purposes. The authors are not responsible for the usage of such palettes.

ggsci/inst/doc/ggsci.R0000644000176200001440000001501113276174760014322 0ustar liggesusers## ------------------------------------------------------------------------ library("ggsci") library("ggplot2") library("gridExtra") 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.05, 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() ## ---- fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150---- p1_npg = p1 + scale_color_npg() p2_npg = p2 + scale_fill_npg() grid.arrange(p1_npg, p2_npg, ncol = 2) ## ---- fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150---- p1_aaas = p1 + scale_color_aaas() p2_aaas = p2 + scale_fill_aaas() grid.arrange(p1_aaas, p2_aaas, ncol = 2) ## ---- fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150---- p1_nejm = p1 + scale_color_nejm() p2_nejm = p2 + scale_fill_nejm() grid.arrange(p1_nejm, p2_nejm, ncol = 2) ## ---- fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150---- p1_lancet = p1 + scale_color_lancet() p2_lancet = p2 + scale_fill_lancet() grid.arrange(p1_lancet, p2_lancet, ncol = 2) ## ---- fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150---- p1_jama = p1 + scale_color_jama() p2_jama = p2 + scale_fill_jama() grid.arrange(p1_jama, p2_jama, ncol = 2) ## ---- fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150---- p1_jco = p1 + scale_color_jco() p2_jco = p2 + scale_fill_jco() grid.arrange(p1_jco, p2_jco, ncol = 2) ## ---- fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150---- p1_ucscgb = p1 + scale_color_ucscgb() p2_ucscgb = p2 + scale_fill_ucscgb() grid.arrange(p1_ucscgb, p2_ucscgb, ncol = 2) ## ---- fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150---- p1_d3 = p1 + scale_color_d3() p2_d3 = p2 + scale_fill_d3() grid.arrange(p1_d3, p2_d3, ncol = 2) ## ---- fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150---- p1_locuszoom = p1 + scale_color_locuszoom() p2_locuszoom = p2 + scale_fill_locuszoom() grid.arrange(p1_locuszoom, p2_locuszoom, ncol = 2) ## ---- fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150---- p1_igv_default = p1 + scale_color_igv() p2_igv_default = p2 + scale_fill_igv() grid.arrange(p1_igv_default, p2_igv_default, ncol = 2) ## ---- fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150---- p1_uchicago = p1 + scale_color_uchicago() p2_uchicago = p2 + scale_fill_uchicago() grid.arrange(p1_uchicago, p2_uchicago, ncol = 2) ## ---- fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150---- p1_startrek = p1 + scale_color_startrek() p2_startrek = p2 + scale_fill_startrek() grid.arrange(p1_startrek, p2_startrek, ncol = 2) ## ---- fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150---- p1_tron = p1 + theme_dark() + theme( panel.background = element_rect(fill = "#2D2D2D"), legend.key = element_rect(fill = "#2D2D2D")) + scale_color_tron() p2_tron = p2 + theme_dark() + theme( panel.background = element_rect(fill = "#2D2D2D")) + scale_fill_tron() grid.arrange(p1_tron, p2_tron, ncol = 2) ## ---- fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150---- p1_futurama = p1 + scale_color_futurama() p2_futurama = p2 + scale_fill_futurama() grid.arrange(p1_futurama, p2_futurama, ncol = 2) ## ---- fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150---- p1_rickandmorty = p1 + scale_color_rickandmorty() p2_rickandmorty = p2 + scale_fill_rickandmorty() grid.arrange(p1_rickandmorty, p2_rickandmorty, ncol = 2) ## ---- fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150---- p1_simpsons = p1 + scale_color_simpsons() p2_simpsons = p2 + scale_fill_simpsons() grid.arrange(p1_simpsons, p2_simpsons, ncol = 2) ## ------------------------------------------------------------------------ library("reshape2") data("mtcars") cor = cor(unname(cbind(mtcars, mtcars, mtcars, mtcars))) cor_melt = melt(cor) p3 = ggplot(cor_melt, aes(x = Var1, y = Var2, fill = value)) + geom_tile(colour = "black", size = 0.3) + theme_bw() + theme(axis.title.x = element_blank(), axis.title.y = element_blank()) ## ---- fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150---- p3_gsea = p3 + scale_fill_gsea() p3_gsea_inv = p3 + scale_fill_gsea(reverse = TRUE) grid.arrange(p3_gsea, p3_gsea_inv, ncol = 2) ## ------------------------------------------------------------------------ library("reshape2") set.seed(42) k = 9 x = diag(k) x[upper.tri(x)] = runif(sum(1:(k - 1)), 0, 1) x_melt = melt(x) p4 = ggplot(x_melt, aes(x = Var1, y = Var2, fill = value)) + geom_tile(colour = "black", size = 0.3) + scale_x_continuous(expand = c(0, 0)) + scale_y_continuous(expand = c(0, 0)) + theme_bw() + theme( legend.position = "none", plot.background = element_blank(), axis.line = element_blank(), axis.ticks = element_blank(), axis.text.x = element_blank(), axis.text.y = element_blank(), axis.title.x = element_blank(), axis.title.y = element_blank(), panel.background = element_blank(), panel.border = element_blank(), panel.grid.major = element_blank(), panel.grid.minor = element_blank()) ## ---- fig.width = 10.67, fig.height = 7.12, out.width = 800, out.height = 533, dpi = 150---- grid.arrange( p4 + scale_fill_material("red"), p4 + scale_fill_material("pink"), p4 + scale_fill_material("purple"), p4 + scale_fill_material("deep-purple"), p4 + scale_fill_material("indigo"), p4 + scale_fill_material("blue"), p4 + scale_fill_material("light-blue"), p4 + scale_fill_material("cyan"), p4 + scale_fill_material("teal"), p4 + scale_fill_material("green"), p4 + scale_fill_material("light-green"), p4 + scale_fill_material("lime"), p4 + scale_fill_material("yellow"), p4 + scale_fill_material("amber"), p4 + scale_fill_material("orange"), p4 + scale_fill_material("deep-orange"), p4 + scale_fill_material("brown"), p4 + scale_fill_material("grey"), p4 + scale_fill_material("blue-grey"), ncol = 6) ## ---- fig.width = 6.67, fig.height = 6.67, out.width = 500, out.height = 500, dpi = 150---- mypal = pal_npg("nrc", alpha = 0.7)(9) mypal library("scales") show_col(mypal) ggsci/inst/doc/ggsci.Rmd0000644000176200001440000004511413276174703014647 0ustar liggesusers--- title: "Scientific Journal and Sci-Fi Themed
Color Palettes for ggplot2" author: "Nan Xiao <>
Miaozhu Li <>" date: "`r Sys.Date()`" output: rmarkdown::html_vignette: toc: true number_sections: true css: ggsci.css vignette: > %\VignetteEngine{knitr::rmarkdown} %\VignetteIndexEntry{Scientific Journal and Sci-Fi Themed Color Palettes for ggplot2} --- # Introduction > My eyes were finally opened and I understood nature. > > I learned at the same time to love it. > > --- Claude Monet `ggsci` offers a collection of high-quality color palettes inspired by colors used in scientific journals, data visualization libraries, science fiction movies, and TV shows. The color palettes in `ggsci` are available as `ggplot2` scales. For all the color palettes, the corresponding scales are named as: * `scale_color_palname()` * `scale_fill_palname()` We also provided aliases, such as `scale_colour_palname()` for `scale_color_palname()`. All available color palettes are summarized in the table below. +-----------------+------------------------------+--------------------------------+----------------------+ | Name | Scales | Palette Types | Palette Generator | +=================+==============================+================================+======================+ | NPG | `scale_color_npg()` | `"nrc"` | `pal_npg()` | | | `scale_fill_npg()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | AAAS | `scale_color_aaas()` | `"default"` | `pal_aaas()` | | | `scale_fill_aaas()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | NEJM | `scale_color_nejm()` | `"default"` | `pal_nejm()` | | | `scale_fill_nejm()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | Lancet | `scale_color_lancet()` | `"lanonc"` | `pal_lancet()` | | | `scale_fill_lancet()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | JAMA | `scale_color_jama()` | `"default"` | `pal_jama()` | | | `scale_fill_jama()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | JCO | `scale_color_jco()` | `"default"` | `pal_jco()` | | | `scale_fill_jco()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | UCSCGB | `scale_color_ucscgb()` | `"default"` | `pal_ucscgb()` | | | `scale_fill_ucscgb()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | D3 | `scale_color_d3()`
| `"category10"` | `pal_d3()` | | | `scale_fill_d3()` | `"category20"` | | | | | `"category20b"` | | | | | `"category20c"` | | +-----------------+------------------------------+--------------------------------+----------------------+ | LocusZoom | `scale_color_locuszoom()` | `"default"` | `pal_locuszoom()` | | | `scale_fill_locuszoom()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | IGV | `scale_color_igv()` | `"default"`
| `pal_igv()` | | | `scale_fill_igv()` | `"alternating"` | | +-----------------+------------------------------+--------------------------------+----------------------+ | UChicago | `scale_color_uchicago()` | `"default"`
| `pal_uchicago()` | | | `scale_fill_uchicago()` | `"light"`
| | | | | `"dark"` | | +-----------------+------------------------------+--------------------------------+----------------------+ | Star Trek | `scale_color_startrek()` | `"uniform"` | `pal_startrek()` | | | `scale_fill_startrek()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | Tron Legacy | `scale_color_tron()` | `"legacy"` | `pal_tron()` | | | `scale_fill_tron()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | Futurama | `scale_color_futurama()` | `"planetexpress"` | `pal_futurama()` | | | `scale_fill_futurama()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | Rick and Morty | `scale_color_rickandmorty()` | `"schwifty"` | `pal_rickandmorty()` | | | `scale_fill_rickandmorty()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | The Simpsons | `scale_color_simpsons()` | `"springfield"` | `pal_simpsons()` | | | `scale_fill_simpsons()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | GSEA | `scale_color_gsea()` | `"default"` | `pal_gsea()` | | | `scale_fill_gsea()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | Material Design | `scale_color_material()` | `"red"` `"pink"`
| `pal_material()` | | | `scale_fill_material()` | `"purple"` `"deep-purple"`
| | | | | `"indigo"` `"blue"`
| | | | | `"light-blue"` `"cyan"`
| | | | | `"teal"` `"green"`
| | | | | `"light-green"` `"lime"`
| | | | | `"yellow"` `"amber"`
| | | | | `"orange"` `"deep-orange"`
| | | | | `"brown"` `"grey"`
| | | | | `"blue-grey"` | | +-----------------+------------------------------+--------------------------------+----------------------+ # Discrete Color Palettes We will use scatterplots with smooth curves, and bar plots to demonstrate the discrete color palettes in `ggsci`. ```{r} library("ggsci") library("ggplot2") library("gridExtra") 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.05, 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() ``` ## NPG The NPG palette is inspired by the plots in the journals published by Nature Publishing Group: ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_npg = p1 + scale_color_npg() p2_npg = p2 + scale_fill_npg() grid.arrange(p1_npg, p2_npg, ncol = 2) ``` ## AAAS The AAAS palette is inspired by the plots in the journals published by American Association for the Advancement of Science: ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_aaas = p1 + scale_color_aaas() p2_aaas = p2 + scale_fill_aaas() grid.arrange(p1_aaas, p2_aaas, ncol = 2) ``` ## NEJM The NEJM palette is inspired by the plots in The New England Journal of Medicine: ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_nejm = p1 + scale_color_nejm() p2_nejm = p2 + scale_fill_nejm() grid.arrange(p1_nejm, p2_nejm, ncol = 2) ``` ## Lancet The Lancet palette is inspired by the plots in Lancet journals, such as Lancet Oncology: ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_lancet = p1 + scale_color_lancet() p2_lancet = p2 + scale_fill_lancet() grid.arrange(p1_lancet, p2_lancet, ncol = 2) ``` ## JAMA The JAMA palette is inspired by the plots in The Journal of the American Medical Association: ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_jama = p1 + scale_color_jama() p2_jama = p2 + scale_fill_jama() grid.arrange(p1_jama, p2_jama, ncol = 2) ``` ## JCO The JCO palette is inspired by the the plots in Journal of Clinical Oncology: ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_jco = p1 + scale_color_jco() p2_jco = p2 + scale_fill_jco() grid.arrange(p1_jco, p2_jco, ncol = 2) ``` ## UCSCGB The UCSCGB palette is from the colors used by [UCSC Genome Browser](https://genome.ucsc.edu) for representing chromosomes. This palette has been intensively used in visualizations produced by [Circos](http://circos.ca). ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_ucscgb = p1 + scale_color_ucscgb() p2_ucscgb = p2 + scale_fill_ucscgb() grid.arrange(p1_ucscgb, p2_ucscgb, ncol = 2) ``` ## D3 The D3 palette is from the categorical colors used by [D3.js](https://d3js.org) (version 3.x and before). There are four palette types (`category10`, `category20`, `category20b`, `category20c`) available. ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_d3 = p1 + scale_color_d3() p2_d3 = p2 + scale_fill_d3() grid.arrange(p1_d3, p2_d3, ncol = 2) ``` ## LocusZoom The LocusZoom palette is based on the colors used by [LocusZoom](http://locuszoom.org/). ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_locuszoom = p1 + scale_color_locuszoom() p2_locuszoom = p2 + scale_fill_locuszoom() grid.arrange(p1_locuszoom, p2_locuszoom, ncol = 2) ``` ## IGV The IGV palette is from the colors used by [Integrative Genomics Viewer](http://software.broadinstitute.org/software/igv/) for representing chromosomes. There are two palette types (`default`, `alternating`) available. ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_igv_default = p1 + scale_color_igv() p2_igv_default = p2 + scale_fill_igv() grid.arrange(p1_igv_default, p2_igv_default, ncol = 2) ``` ## UChicago The UChicago palette is based on [the colors](https://news.uchicago.edu/sites/default/files/attachments/_uchicago.identity.guidelines.pdf) used by the University of Chicago. There are three palette types (`default`, `light`, `dark`) available. ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_uchicago = p1 + scale_color_uchicago() p2_uchicago = p2 + scale_fill_uchicago() grid.arrange(p1_uchicago, p2_uchicago, ncol = 2) ``` ## Star Trek This palette is inspired by the (uniform) colors in Star Trek: ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_startrek = p1 + scale_color_startrek() p2_startrek = p2 + scale_fill_startrek() grid.arrange(p1_startrek, p2_startrek, ncol = 2) ``` ## Tron Legacy This palette is inspired by the colors used in Tron Legacy. It is suitable for displaying data when using a dark theme: ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_tron = p1 + theme_dark() + theme( panel.background = element_rect(fill = "#2D2D2D"), legend.key = element_rect(fill = "#2D2D2D")) + scale_color_tron() p2_tron = p2 + theme_dark() + theme( panel.background = element_rect(fill = "#2D2D2D")) + scale_fill_tron() grid.arrange(p1_tron, p2_tron, ncol = 2) ``` ## Futurama This palette is inspired by the colors used in the TV show Futurama: ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_futurama = p1 + scale_color_futurama() p2_futurama = p2 + scale_fill_futurama() grid.arrange(p1_futurama, p2_futurama, ncol = 2) ``` ## Rick and Morty This palette is inspired by the colors used in the TV show Rick and Morty: ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_rickandmorty = p1 + scale_color_rickandmorty() p2_rickandmorty = p2 + scale_fill_rickandmorty() grid.arrange(p1_rickandmorty, p2_rickandmorty, ncol = 2) ``` ## The Simpsons This palette is inspired by the colors used in the TV show The Simpsons: ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_simpsons = p1 + scale_color_simpsons() p2_simpsons = p2 + scale_fill_simpsons() grid.arrange(p1_simpsons, p2_simpsons, ncol = 2) ``` # Continuous Color Palettes We will use a correlation matrix visualization (a special type of heatmap) to demonstrate the continuous color palettes in `ggsci`. ```{r} library("reshape2") data("mtcars") cor = cor(unname(cbind(mtcars, mtcars, mtcars, mtcars))) cor_melt = melt(cor) p3 = ggplot(cor_melt, aes(x = Var1, y = Var2, fill = value)) + geom_tile(colour = "black", size = 0.3) + theme_bw() + theme(axis.title.x = element_blank(), axis.title.y = element_blank()) ``` ## GSEA The GSEA palette (continuous) is inspired by the heatmaps generated by [GSEA GenePattern](https://software.broadinstitute.org/cancer/software/genepattern/). ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p3_gsea = p3 + scale_fill_gsea() p3_gsea_inv = p3 + scale_fill_gsea(reverse = TRUE) grid.arrange(p3_gsea, p3_gsea_inv, ncol = 2) ``` ## Material Design The Material Design color palettes are from the [material design color guidelines](https://material.io/guidelines/style/color.html). We generate a random matrix first: ```{r} library("reshape2") set.seed(42) k = 9 x = diag(k) x[upper.tri(x)] = runif(sum(1:(k - 1)), 0, 1) x_melt = melt(x) p4 = ggplot(x_melt, aes(x = Var1, y = Var2, fill = value)) + geom_tile(colour = "black", size = 0.3) + scale_x_continuous(expand = c(0, 0)) + scale_y_continuous(expand = c(0, 0)) + theme_bw() + theme( legend.position = "none", plot.background = element_blank(), axis.line = element_blank(), axis.ticks = element_blank(), axis.text.x = element_blank(), axis.text.y = element_blank(), axis.title.x = element_blank(), axis.title.y = element_blank(), panel.background = element_blank(), panel.border = element_blank(), panel.grid.major = element_blank(), panel.grid.minor = element_blank()) ``` Plot the matrix with the 19 material design color palettes: ```{r, fig.width = 10.67, fig.height = 7.12, out.width = 800, out.height = 533, dpi = 150} grid.arrange( p4 + scale_fill_material("red"), p4 + scale_fill_material("pink"), p4 + scale_fill_material("purple"), p4 + scale_fill_material("deep-purple"), p4 + scale_fill_material("indigo"), p4 + scale_fill_material("blue"), p4 + scale_fill_material("light-blue"), p4 + scale_fill_material("cyan"), p4 + scale_fill_material("teal"), p4 + scale_fill_material("green"), p4 + scale_fill_material("light-green"), p4 + scale_fill_material("lime"), p4 + scale_fill_material("yellow"), p4 + scale_fill_material("amber"), p4 + scale_fill_material("orange"), p4 + scale_fill_material("deep-orange"), p4 + scale_fill_material("brown"), p4 + scale_fill_material("grey"), p4 + scale_fill_material("blue-grey"), ncol = 6) ``` From the figure above, we can see that even though an identical matrix was visualized by all plots, some palettes are more preferrable than the others because our eyes are more sensitive to the changes of their saturation levels. # Non-ggplot2 Graphics To apply the color palettes in `ggsci` to other graphics systems (such as base graphics and lattice graphics), simply use the palette generator functions in the table above. For example: ```{r, fig.width = 6.67, fig.height = 6.67, out.width = 500, out.height = 500, dpi = 150} mypal = pal_npg("nrc", alpha = 0.7)(9) mypal library("scales") show_col(mypal) ``` You will be able to use the generated hex color codes for such graphics systems accordingly. The transparent level of the entire palette is easily adjustable via the argument `"alpha"` in every generator or scale function. # Discussion Please note some of the palettes might not be the best choice for certain purposes, such as color-blind safe, photocopy safe, or print friendly. If you do have such considerations, you might want to check out color palettes like [ColorBrewer](http://colorbrewer2.org) and [viridis](https://cran.r-project.org/package=viridis). The color palettes in this package are solely created for research purposes. The authors are not responsible for the usage of such palettes. ggsci/NAMESPACE0000644000176200001440000000407013276174722012601 0ustar liggesusers# Generated by roxygen2: do not edit by hand export(pal_aaas) export(pal_d3) export(pal_futurama) export(pal_gsea) export(pal_igv) export(pal_jama) export(pal_jco) export(pal_lancet) export(pal_locuszoom) export(pal_material) export(pal_nejm) export(pal_npg) export(pal_rickandmorty) export(pal_simpsons) export(pal_startrek) export(pal_tron) export(pal_uchicago) export(pal_ucscgb) export(rgb_gsea) export(rgb_material) export(scale_color_aaas) export(scale_color_d3) export(scale_color_futurama) export(scale_color_gsea) export(scale_color_igv) export(scale_color_jama) export(scale_color_jco) export(scale_color_lancet) export(scale_color_locuszoom) export(scale_color_material) export(scale_color_nejm) export(scale_color_npg) export(scale_color_rickandmorty) export(scale_color_simpsons) export(scale_color_startrek) export(scale_color_tron) export(scale_color_uchicago) export(scale_color_ucscgb) export(scale_colour_aaas) export(scale_colour_d3) export(scale_colour_futurama) export(scale_colour_gsea) export(scale_colour_igv) export(scale_colour_jama) export(scale_colour_jco) export(scale_colour_lancet) export(scale_colour_locuszoom) export(scale_colour_material) export(scale_colour_nejm) export(scale_colour_npg) export(scale_colour_rickandmorty) export(scale_colour_simpsons) export(scale_colour_startrek) export(scale_colour_tron) export(scale_colour_uchicago) export(scale_colour_ucscgb) export(scale_fill_aaas) export(scale_fill_d3) export(scale_fill_futurama) export(scale_fill_gsea) export(scale_fill_igv) export(scale_fill_jama) export(scale_fill_jco) export(scale_fill_lancet) export(scale_fill_locuszoom) export(scale_fill_material) export(scale_fill_nejm) export(scale_fill_npg) export(scale_fill_rickandmorty) export(scale_fill_simpsons) export(scale_fill_startrek) export(scale_fill_tron) export(scale_fill_uchicago) export(scale_fill_ucscgb) importFrom(ggplot2,discrete_scale) importFrom(ggplot2,scale_color_gradientn) importFrom(ggplot2,scale_fill_gradientn) importFrom(grDevices,col2rgb) importFrom(grDevices,colorRamp) importFrom(grDevices,rgb) importFrom(scales,manual_pal) ggsci/NEWS.md0000644000176200001440000000162113276173326012456 0ustar liggesusers# ggsci 2.9 (2018-05-13) ## Improvements - New URL for the documentation website: https://nanx.me/ggsci/. # ggsci 2.8 (2017-09-30) ## Improvements - Use system font stack instead of Google Fonts in vignettes to avoid pandoc SSL issue. # ggsci 2.7 (2017-06-12) ## New Features Two new discrete color palettes: - JAMA - Tron Legacy One new collection of continuous palettes with 19 color options: - Material Design # ggsci 2.4 (2017-03-07) ## New Features Four new discrete color palettes: - NEJM - LocusZoom - IGV - Star Trek # ggsci 2.0 (2016-11-20) ## New Features Two new discrete color palettes: - D3.js (v3) - Futurama (Planet Express) The first continuous color palette: - GSEA GenePattern # ggsci 1.0 (2016-04-01) ## New Features Eight discrete color palettes: - NPG - AAAS - Lancet - JCO - UCSCGB - UChicago - The Simpsons (Springfield) - Rick and Morty (Schwifty) ggsci/R/0000755000176200001440000000000013221611720011542 5ustar liggesusersggsci/R/discrete-ucscgb.R0000644000176200001440000000476113221611720014743 0ustar liggesusers#' UCSC Genome Browser Color Palette #' #' Color palette from UCSC Genome Browser chromosome colors. #' #' @param palette Palette type. #' Currently there is one available option: \code{"default"} #' (26-color palette). #' @param alpha Transparency level, a real number in (0, 1]. #' See \code{alpha} in \code{\link[grDevices]{rgb}} for details. #' #' @export pal_ucscgb #' #' @importFrom grDevices col2rgb rgb #' @importFrom scales manual_pal #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @examples #' library("scales") #' show_col(pal_ucscgb("default")(26)) #' show_col(pal_ucscgb("default", alpha = 0.6)(26)) pal_ucscgb = function (palette = c('default'), alpha = 1) { palette = match.arg(palette) if (alpha > 1L | alpha <= 0L) stop('alpha must be in (0, 1]') raw_cols = ggsci_db$'ucscgb'[[palette]] raw_cols_rgb = col2rgb(raw_cols) alpha_cols = rgb( raw_cols_rgb[1L, ], raw_cols_rgb[2L, ], raw_cols_rgb[3L, ], alpha = alpha * 255L, names = names(raw_cols), maxColorValue = 255L) manual_pal(unname(alpha_cols)) } #' UCSC Genome Browser Color Scales #' #' See \code{\link{pal_ucscgb}} for details. #' #' @inheritParams pal_ucscgb #' @param ... additional parameters for \code{\link[ggplot2]{discrete_scale}} #' #' @export scale_color_ucscgb #' #' @importFrom ggplot2 discrete_scale #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @rdname scale_ucscgb #' #' @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() scale_color_ucscgb = function (palette = c('default'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('colour', 'ucscgb', pal_ucscgb(palette, alpha), ...) } #' @export scale_colour_ucscgb #' @rdname scale_ucscgb scale_colour_ucscgb = scale_color_ucscgb #' @export scale_fill_ucscgb #' @importFrom ggplot2 discrete_scale #' @rdname scale_ucscgb scale_fill_ucscgb = function (palette = c('default'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('fill', 'ucscgb', pal_ucscgb(palette, alpha), ...) } ggsci/R/discrete-locuszoom.R0000644000176200001440000000531613221611720015524 0ustar liggesusers#' LocusZoom Color Palette #' #' Color palettes based on the colors used by LocusZoom. #' #' @param palette Palette type. #' Currently there is one available option: \code{"default"} #' (7-color palette). #' @param alpha Transparency level, a real number in (0, 1]. #' See \code{alpha} in \code{\link[grDevices]{rgb}} for details. #' #' @export pal_locuszoom #' #' @importFrom grDevices col2rgb rgb #' @importFrom scales manual_pal #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @references #' Pruim, Randall J., et al. (2010). LocusZoom: regional visualization of #' genome-wide association scan results. \emph{Bioinformatics}, #' 26(18), 2336--2337. #' #' @examples #' library("scales") #' show_col(pal_locuszoom("default")(7)) #' show_col(pal_locuszoom("default", alpha = 0.6)(7)) pal_locuszoom = function (palette = c('default'), alpha = 1) { palette = match.arg(palette) if (alpha > 1L | alpha <= 0L) stop('alpha must be in (0, 1]') raw_cols = ggsci_db$'locuszoom'[[palette]] raw_cols_rgb = col2rgb(raw_cols) alpha_cols = rgb( raw_cols_rgb[1L, ], raw_cols_rgb[2L, ], raw_cols_rgb[3L, ], alpha = alpha * 255L, names = names(raw_cols), maxColorValue = 255L) manual_pal(unname(alpha_cols)) } #' LocusZoom Color Scales #' #' See \code{\link{pal_locuszoom}} for details. #' #' @inheritParams pal_locuszoom #' @param ... additional parameters for \code{\link[ggplot2]{discrete_scale}} #' #' @export scale_color_locuszoom #' #' @importFrom ggplot2 discrete_scale #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @rdname scale_locuszoom #' #' @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() scale_color_locuszoom = function (palette = c('default'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('colour', 'locuszoom', pal_locuszoom(palette, alpha), ...) } #' @export scale_colour_locuszoom #' @rdname scale_locuszoom scale_colour_locuszoom = scale_color_locuszoom #' @export scale_fill_locuszoom #' @importFrom ggplot2 discrete_scale #' @rdname scale_locuszoom scale_fill_locuszoom = function (palette = c('default'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('fill', 'locuszoom', pal_locuszoom(palette, alpha), ...) } ggsci/R/discrete-uchicago.R0000644000176200001440000000623613276174433015275 0ustar liggesusers#' The University of Chicago Color Palettes #' #' Color palettes based on the colors used by the University of Chicago. #' #' @param palette Palette type. #' There are 3 available options: #' \code{"default"} (9-color palette); #' \code{"light"} (9-color light palette); #' \code{"dark"} (9-color dark palette). #' @param alpha Transparency level, a real number in (0, 1]. #' See \code{alpha} in \code{\link[grDevices]{rgb}} for details. #' #' @export pal_uchicago #' #' @importFrom grDevices col2rgb rgb #' @importFrom scales manual_pal #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @references \url{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)) pal_uchicago = function ( palette = c('default', 'light', 'dark'), alpha = 1) { palette = match.arg(palette) if (alpha > 1L | alpha <= 0L) stop('alpha must be in (0, 1]') raw_cols = ggsci_db$'uchicago'[[palette]] raw_cols_rgb = col2rgb(raw_cols) alpha_cols = rgb( raw_cols_rgb[1L, ], raw_cols_rgb[2L, ], raw_cols_rgb[3L, ], alpha = alpha * 255L, names = names(raw_cols), maxColorValue = 255L) manual_pal(unname(alpha_cols)) } #' The University of Chicago Color Scales #' #' See \code{\link{pal_uchicago}} for details. #' #' @inheritParams pal_uchicago #' @param ... additional parameters for \code{\link[ggplot2]{discrete_scale}} #' #' @export scale_color_uchicago #' #' @importFrom ggplot2 discrete_scale #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @references \url{https://news.uchicago.edu/sites/default/files/attachments/_uchicago.identity.guidelines.pdf} #' #' @rdname scale_uchicago #' #' @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") scale_color_uchicago = function ( palette = c('default', 'light', 'dark'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('colour', 'uchicago', pal_uchicago(palette, alpha), ...) } #' @export scale_colour_uchicago #' @rdname scale_uchicago scale_colour_uchicago = scale_color_uchicago #' @export scale_fill_uchicago #' @importFrom ggplot2 discrete_scale #' @rdname scale_uchicago scale_fill_uchicago = function ( palette = c('default', 'light', 'dark'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('fill', 'uchicago', pal_uchicago(palette, alpha), ...) } ggsci/R/discrete-igv.R0000644000176200001440000000574113221611720014261 0ustar liggesusers#' Integrative Genomics Viewer (IGV) Color Palettes #' #' Color palettes based on the colors used by #' Integrative Genomics Viewer (IGV). #' #' @param palette Palette type. #' There are two available options: #' \code{"default"} (51-color palette); #' \code{"alternating"} (2-color palette). #' @param alpha Transparency level, a real number in (0, 1]. #' See \code{alpha} in \code{\link[grDevices]{rgb}} for details. #' #' @export pal_igv #' #' @importFrom grDevices col2rgb rgb #' @importFrom scales manual_pal #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @references #' James T. Robinson, Helga Thorvaldsd\'{o}ttir, Wendy Winckler, #' Mitchell Guttman, Eric S. Lander, Gad Getz, Jill P. Mesirov. #' Integrative Genomics Viewer. \emph{Nature Biotechnology} 29, 24--26 (2011). #' #' @examples #' library("scales") #' show_col(pal_igv("default")(51)) #' show_col(pal_igv("alternating")(2)) pal_igv = function ( palette = c('default', 'alternating'), alpha = 1) { palette = match.arg(palette) if (alpha > 1L | alpha <= 0L) stop('alpha must be in (0, 1]') raw_cols = ggsci_db$'igv'[[palette]] raw_cols_rgb = col2rgb(raw_cols) alpha_cols = rgb( raw_cols_rgb[1L, ], raw_cols_rgb[2L, ], raw_cols_rgb[3L, ], alpha = alpha * 255L, names = names(raw_cols), maxColorValue = 255L) manual_pal(unname(alpha_cols)) } #' Integrative Genomics Viewer (IGV) Color Scales #' #' See \code{\link{pal_igv}} for details. #' #' @inheritParams pal_igv #' @param ... additional parameters for \code{\link[ggplot2]{discrete_scale}} #' #' @export scale_color_igv #' #' @importFrom ggplot2 discrete_scale #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @rdname scale_igv #' #' @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)) scale_color_igv = function ( palette = c('default', 'alternating'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('colour', 'igv', pal_igv(palette, alpha), ...) } #' @export scale_colour_igv #' @rdname scale_igv scale_colour_igv = scale_color_igv #' @export scale_fill_igv #' @importFrom ggplot2 discrete_scale #' @rdname scale_igv scale_fill_igv = function ( palette = c('default', 'alternating'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('fill', 'igv', pal_igv(palette, alpha), ...) } ggsci/R/discrete-d3.R0000644000176200001440000000637613221611720014007 0ustar liggesusers#' D3.js Color Palettes #' #' Color palettes based on the colors used by D3.js. #' #' @param palette Palette type. #' There are 4 available options: #' \code{"category10"} (10-color palette); #' \code{"category20"} (20-color palette); #' \code{"category20b"} (20-color palette); #' \code{"category20c"} (20-color palette). #' @param alpha Transparency level, a real number in (0, 1]. #' See \code{alpha} in \code{\link[grDevices]{rgb}} for details. #' #' @export pal_d3 #' #' @importFrom grDevices col2rgb rgb #' @importFrom scales manual_pal #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @references \url{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)) pal_d3 = function ( palette = c('category10', 'category20', 'category20b', 'category20c'), alpha = 1) { palette = match.arg(palette) if (alpha > 1L | alpha <= 0L) stop('alpha must be in (0, 1]') raw_cols = ggsci_db$'d3'[[palette]] raw_cols_rgb = col2rgb(raw_cols) alpha_cols = rgb( raw_cols_rgb[1L, ], raw_cols_rgb[2L, ], raw_cols_rgb[3L, ], alpha = alpha * 255L, names = names(raw_cols), maxColorValue = 255L) manual_pal(unname(alpha_cols)) } #' D3.js Color Scales #' #' See \code{\link{pal_d3}} for details. #' #' @inheritParams pal_d3 #' @param ... additional parameters for \code{\link[ggplot2]{discrete_scale}} #' #' @export scale_color_d3 #' #' @importFrom ggplot2 discrete_scale #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @references \url{https://github.com/d3/d3-3.x-api-reference/blob/master/Ordinal-Scales.md} #' #' @rdname scale_d3 #' #' @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") scale_color_d3 = function ( palette = c('category10', 'category20', 'category20b', 'category20c'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('colour', 'd3', pal_d3(palette, alpha), ...) } #' @export scale_colour_d3 #' @rdname scale_d3 scale_colour_d3 = scale_color_d3 #' @export scale_fill_d3 #' @importFrom ggplot2 discrete_scale #' @rdname scale_d3 scale_fill_d3 = function ( palette = c('category10', 'category20', 'category20b', 'category20c'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('fill', 'd3', pal_d3(palette, alpha), ...) } ggsci/R/discrete-nejm.R0000644000176200001440000000467313221611720014430 0ustar liggesusers#' NEJM Color Palettes #' #' Color palette inspired by plots in #' \emph{The New England Journal of Medicine}. #' #' @param palette Palette type. #' Currently there is one available option: \code{"default"} #' (8-color palette). #' @param alpha Transparency level, a real number in (0, 1]. #' See \code{alpha} in \code{\link[grDevices]{rgb}} for details. #' #' @export pal_nejm #' #' @importFrom grDevices col2rgb rgb #' @importFrom scales manual_pal #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @examples #' library("scales") #' show_col(pal_nejm("default")(8)) #' show_col(pal_nejm("default", alpha = 0.6)(8)) pal_nejm = function (palette = c('default'), alpha = 1) { palette = match.arg(palette) if (alpha > 1L | alpha <= 0L) stop('alpha must be in (0, 1]') raw_cols = ggsci_db$'nejm'[[palette]] raw_cols_rgb = col2rgb(raw_cols) alpha_cols = rgb( raw_cols_rgb[1L, ], raw_cols_rgb[2L, ], raw_cols_rgb[3L, ], alpha = alpha * 255L, names = names(raw_cols), maxColorValue = 255L) manual_pal(unname(alpha_cols)) } #' NEJM Color Scales #' #' See \code{\link{pal_nejm}} for details. #' #' @inheritParams pal_nejm #' @param ... additional parameters for \code{\link[ggplot2]{discrete_scale}} #' #' @export scale_color_nejm #' #' @importFrom ggplot2 discrete_scale #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @rdname scale_nejm #' #' @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() scale_color_nejm = function (palette = c('default'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('colour', 'nejm', pal_nejm(palette, alpha), ...) } #' @export scale_colour_nejm #' @rdname scale_nejm scale_colour_nejm = scale_color_nejm #' @export scale_fill_nejm #' @importFrom ggplot2 discrete_scale #' @rdname scale_nejm scale_fill_nejm = function (palette = c('default'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('fill', 'nejm', pal_nejm(palette, alpha), ...) } ggsci/R/sysdata.rda0000644000176200001440000001167113221611720013710 0ustar liggesusers\[sƱVDI*yJyv ;17;舊c .a-,|*,5.3g;rgϞ?;:~Q>{gb=kw>\y{u/ )!Z̔!5)5BO -+rFX67dd9YaŋUu[iV}=⋫C~]uSz5vSݾkforv5gnWTݲ$߶ʴUw&<7^hN լ("s%e,H\/:H>B9/Ke\Df*{sy1y|)M]~8{(Lo7^f^߸nYTCgM;a_ja4e!H$:R$)\h%T _c[SSf 9ЏwrȽu}gn끋sUvI{>4Wղm=,f7ouh<ޘP̜M NsQ ѩx[z "%@-t4;tҴE0uOS}Q-5p@ML4mY2f5p?V|ܴm 406w~ {YlG^-:yflIyTBcnJ8:,x&/'ΚҁC]!ֽ_&XDf%DW22l8` V]?ӫBC=rc ( \ vcq)}ۍc߰qиݮ7'>o. ^c9M\ GK}ie5oqy^_6[.} ;6oE*¤xq„ aΜPP ҥ4^̭-D!"J] ^9 LAd)HCr9PVbSklu0a$o-E䊇8vd}>,?I:קl ,a$(Id6ٜOP ˤI(M`߫L $]Y {}V@Ն L WV9 ad>jwKi`a&pΖ$8L%V6= ؃$dto:I$xIII(====`=`=`=`=`YFGO#%M,jWi5oLzY6zl=ifq! \fxe8ҝ+ #93yr0XhXRqlzQmYbaĬ"bcqAqdΫO,=)%/\,iNYdPT90\}H`Iz`6sdj#CN^W];#>``h*|*c0t SPA}۴!A>HV$i q6õe>142U0ݔ0Y'$=aibJ(C 3ð(9%p1#nQGv6WG}ًe<Q[;=M]iaGe4(PByУ >9A7#tR:a:pA(G(gumS8>{@m3*&jϯ9/$wzDoz]ft=Qh dC΍Y77 CUŴMW>J2Xz1- _բYuL^͚z5zUjڱdX>ӭ_WO.=oWu~Y`o+ (1P`^d,rU68YnڻٲZo/W v.m ,E5g80 "2,5WPiUܤZn'qP8HxKXѓ:y4px]>e~Pe#.Fͦ/׮Co]?X>(m2eFȸ3uIIOVwaa,:"²a%0F!u<$iO@"ݐSg=Exϱ IMKOHLJЮ0%@qAqBimamgK2 ԆwVZ@Dra9Hea=@IoZQK= I!M!K!OHLJAxG{HRHSRS(R(SRxscݻcr'*kt n8Zz$4,<"2*i"R~d9H~UP%!܅r/Ju|ϥ?HC5ưb T>@Nj**Ypal#,5yZ`){ ܭe6zd ,&XNOJ]0Ac¡ MMPȑVX%ֈy@󃄞>>` T>@Nj*8HvEѸ7Z*peаuwxq'X Cb4ҞPfWMYM SAH >!'rP z-0#C1Sete~Goe9 Nei5s! H2>2rPa2t ,'XMA.OjfN7I?_߼?"&P/G!PPP]!3^؁ig"EV?p/2D&-r&%rIN "T$Sz*N^ˎq. <8/I%.v/@r1x>Q8gζK즙U#ϧnݮN^o7.6w5j~:Tݦ?Hz}M|ٿz+Eggsci/R/discrete-futurama.R0000644000176200001440000000507313221611720015316 0ustar liggesusers#' The Futurama Color Palettes #' #' Color palettes inspired by the colors used in \emph{Futurama}. #' #' @param palette Palette type. #' Currently there is one available option: \code{"planetexpress"} #' (12-color palette). #' @param alpha Transparency level, a real number in (0, 1]. #' See \code{alpha} in \code{\link[grDevices]{rgb}} for details. #' #' @export pal_futurama #' #' @importFrom grDevices col2rgb rgb #' @importFrom scales manual_pal #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @examples #' library("scales") #' show_col(pal_futurama("planetexpress")(12)) #' show_col(pal_futurama("planetexpress", alpha = 0.6)(12)) pal_futurama = function (palette = c('planetexpress'), alpha = 1) { palette = match.arg(palette) if (alpha > 1L | alpha <= 0L) stop('alpha must be in (0, 1]') raw_cols = ggsci_db$'futurama'[[palette]] raw_cols_rgb = col2rgb(raw_cols) alpha_cols = rgb( raw_cols_rgb[1L, ], raw_cols_rgb[2L, ], raw_cols_rgb[3L, ], alpha = alpha * 255L, names = names(raw_cols), maxColorValue = 255L) manual_pal(unname(alpha_cols)) } #' The Futurama Color Scales #' #' See \code{\link{pal_futurama}} for details. #' #' @inheritParams pal_futurama #' @param ... additional parameters for \code{\link[ggplot2]{discrete_scale}} #' #' @export scale_color_futurama #' #' @importFrom ggplot2 discrete_scale #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @rdname scale_futurama #' #' @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() scale_color_futurama = function (palette = c('planetexpress'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('colour', 'futurama', pal_futurama(palette, alpha), ...) } #' @export scale_colour_futurama #' @rdname scale_futurama scale_colour_futurama = scale_color_futurama #' @export scale_fill_futurama #' @importFrom ggplot2 discrete_scale #' @rdname scale_futurama scale_fill_futurama = function (palette = c('planetexpress'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('fill', 'futurama', pal_futurama(palette, alpha), ...) } ggsci/R/continuous-gsea.R0000644000176200001440000000706313221611720015016 0ustar liggesusers#' The GSEA GenePattern Color Palettes #' #' Color palette inspired by the colors used in the #' heatmaps plotted by GSEA GenePattern. #' #' @param palette Palette type. #' Currently there is one available option: \code{"default"} #' (continuous palette with 12 base colors). #' @param n Number of individual colors to be generated. #' @param alpha Transparency level, a real number in (0, 1]. #' See \code{alpha} in \code{\link[grDevices]{rgb}} for details. #' @param reverse Logical. Should the order of the colors be reversed? #' #' @export rgb_gsea #' #' @importFrom grDevices colorRamp rgb #' @importFrom scales manual_pal #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @note The 12 base colors used in this palette are derived from #' \href{ftp://ftp.broad.mit.edu/pub/genepattern/modules/HeatMapImage/broad.mit.edu:cancer.software.genepattern.module.analysis/00032/6/HeatMapImage.pdf}{this document}. #' #' @examples #' library("scales") #' show_col(pal_gsea("default")(12)) #' show_col(pal_gsea("default", n = 30, alpha = 0.6, reverse = TRUE)(30)) rgb_gsea = function ( palette = c('default'), n = 12, alpha = 1, reverse = FALSE) { palette = match.arg(palette) if (alpha > 1L | alpha <= 0L) stop('alpha must be in (0, 1]') raw_cols = ggsci_db$'gsea'[[palette]] func_cols = colorRamp(raw_cols, space = 'Lab', interpolate = 'spline') mat_cols = func_cols(seq(0L, 1L, length.out = n)) alpha_cols = rgb( mat_cols[, 1L], mat_cols[, 2L], mat_cols[, 3L], alpha = alpha * 255L, maxColorValue = 255L) if (reverse) alpha_cols = rev(alpha_cols) alpha_cols } #' The GSEA GenePattern Color Palettes #' #' Color palette inspired by the colors used in the #' heatmaps plotted by GSEA GenePattern. #' #' @inheritParams rgb_gsea #' #' @export pal_gsea #' #' @importFrom scales manual_pal #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{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)) pal_gsea = function ( palette = c('default'), n = 12, alpha = 1, reverse = FALSE) { palette = match.arg(palette) alpha_cols = rgb_gsea(palette, n, alpha, reverse) manual_pal(unname(alpha_cols)) } #' The GSEA GenePattern Color Scales #' #' See \code{\link{pal_gsea}} for details. #' #' @inheritParams pal_gsea #' @param ... additional parameters for \code{\link[ggplot2]{discrete_scale}} #' #' @export scale_color_gsea #' #' @importFrom ggplot2 scale_color_gradientn #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @rdname scale_gsea #' #' @examples #' library("ggplot2") #' library("reshape2") #' data("mtcars") #' #' cor = cor(mtcars) #' cor_melt = melt(cor) #' #' ggplot(cor_melt, #' aes(x = Var1, y = Var2, fill = value)) + #' geom_tile(colour = "black", size = 0.3) + #' theme_bw() + scale_fill_gsea() scale_color_gsea = function ( palette = c('default'), alpha = 1, reverse = FALSE, ...) { palette = match.arg(palette) scale_color_gradientn(colours = rgb_gsea( palette, n = 512, alpha = alpha, reverse = reverse), ...) } #' @export scale_colour_gsea #' @rdname scale_gsea scale_colour_gsea = scale_color_gsea #' @export scale_fill_gsea #' @importFrom ggplot2 scale_fill_gradientn #' @rdname scale_gsea scale_fill_gsea = function ( palette = c('default'), alpha = 1, reverse = FALSE, ...) { palette = match.arg(palette) scale_fill_gradientn(colours = rgb_gsea( palette, n = 512, alpha = alpha, reverse = reverse), ...) } ggsci/R/discrete-startrek.R0000644000176200001440000000501713221611720015327 0ustar liggesusers#' Star Trek Color Palettes #' #' Color palettes inspired by the colors used in \emph{Star Trek}. #' #' @param palette Palette type. #' Currently there is one available option: \code{"uniform"} #' (7-color palette). #' @param alpha Transparency level, a real number in (0, 1]. #' See \code{alpha} in \code{\link[grDevices]{rgb}} for details. #' #' @export pal_startrek #' #' @importFrom grDevices col2rgb rgb #' @importFrom scales manual_pal #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @examples #' library("scales") #' show_col(pal_startrek("uniform")(7)) #' show_col(pal_startrek("uniform", alpha = 0.6)(7)) pal_startrek = function (palette = c('uniform'), alpha = 1) { palette = match.arg(palette) if (alpha > 1L | alpha <= 0L) stop('alpha must be in (0, 1]') raw_cols = ggsci_db$'startrek'[[palette]] raw_cols_rgb = col2rgb(raw_cols) alpha_cols = rgb( raw_cols_rgb[1L, ], raw_cols_rgb[2L, ], raw_cols_rgb[3L, ], alpha = alpha * 255L, names = names(raw_cols), maxColorValue = 255L) manual_pal(unname(alpha_cols)) } #' Star Trek Color Scales #' #' See \code{\link{pal_startrek}} for details. #' #' @inheritParams pal_startrek #' @param ... additional parameters for \code{\link[ggplot2]{discrete_scale}} #' #' @export scale_color_startrek #' #' @importFrom ggplot2 discrete_scale #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @rdname scale_startrek #' #' @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() scale_color_startrek = function (palette = c('uniform'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('colour', 'startrek', pal_startrek(palette, alpha), ...) } #' @export scale_colour_startrek #' @rdname scale_startrek scale_colour_startrek = scale_color_startrek #' @export scale_fill_startrek #' @importFrom ggplot2 discrete_scale #' @rdname scale_startrek scale_fill_startrek = function (palette = c('uniform'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('fill', 'startrek', pal_startrek(palette, alpha), ...) } ggsci/R/discrete-rickandmorty.R0000644000176200001440000000520313221611720016173 0ustar liggesusers#' Rick and Morty Color Palettes #' #' Color palettes inspired by the colors used in \emph{Rick and Morty}. #' #' @param palette Palette type. #' Currently there is one available option: \code{"schwifty"} #' (12-color palette). #' @param alpha Transparency level, a real number in (0, 1]. #' See \code{alpha} in \code{\link[grDevices]{rgb}} for details. #' #' @export pal_rickandmorty #' #' @importFrom grDevices col2rgb rgb #' @importFrom scales manual_pal #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @examples #' library("scales") #' show_col(pal_rickandmorty("schwifty")(12)) #' show_col(pal_rickandmorty("schwifty", alpha = 0.6)(12)) pal_rickandmorty = function (palette = c('schwifty'), alpha = 1) { palette = match.arg(palette) if (alpha > 1L | alpha <= 0L) stop('alpha must be in (0, 1]') raw_cols = ggsci_db$'rickandmorty'[[palette]] raw_cols_rgb = col2rgb(raw_cols) alpha_cols = rgb( raw_cols_rgb[1L, ], raw_cols_rgb[2L, ], raw_cols_rgb[3L, ], alpha = alpha * 255L, names = names(raw_cols), maxColorValue = 255L) manual_pal(unname(alpha_cols)) } #' Rick and Morty Color Scales #' #' See \code{\link{pal_rickandmorty}} for details. #' #' @inheritParams pal_rickandmorty #' @param ... additional parameters for \code{\link[ggplot2]{discrete_scale}} #' #' @export scale_color_rickandmorty #' #' @importFrom ggplot2 discrete_scale #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @rdname scale_rickandmorty #' #' @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() scale_color_rickandmorty = function (palette = c('schwifty'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('colour', 'rickandmorty', pal_rickandmorty(palette, alpha), ...) } #' @export scale_colour_rickandmorty #' @rdname scale_rickandmorty scale_colour_rickandmorty = scale_color_rickandmorty #' @export scale_fill_rickandmorty #' @importFrom ggplot2 discrete_scale #' @rdname scale_rickandmorty scale_fill_rickandmorty = function (palette = c('schwifty'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('fill', 'rickandmorty', pal_rickandmorty(palette, alpha), ...) } ggsci/R/discrete-jama.R0000644000176200001440000000502513221611720014377 0ustar liggesusers#' Journal of the American Medical Association Color Palettes #' #' Color palette inspired by plots in #' \emph{The Journal of the American Medical Association}. #' #' @param palette Palette type. #' Currently there is one available option: \code{"default"} #' (7-color palette). #' @param alpha Transparency level, a real number in (0, 1]. #' See \code{alpha} in \code{\link[grDevices]{rgb}} for details. #' #' @export pal_jama #' #' @importFrom grDevices col2rgb rgb #' @importFrom scales manual_pal #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @examples #' library("scales") #' show_col(pal_jama("default")(7)) #' show_col(pal_jama("default", alpha = 0.6)(7)) pal_jama = function (palette = c('default'), alpha = 1) { palette = match.arg(palette) if (alpha > 1L | alpha <= 0L) stop('alpha must be in (0, 1]') raw_cols = ggsci_db$'jama'[[palette]] raw_cols_rgb = col2rgb(raw_cols) alpha_cols = rgb( raw_cols_rgb[1L, ], raw_cols_rgb[2L, ], raw_cols_rgb[3L, ], alpha = alpha * 255L, names = names(raw_cols), maxColorValue = 255L) manual_pal(unname(alpha_cols)) } #' Journal of the American Medical Association Color Scales #' #' See \code{\link{pal_jama}} for details. #' #' @inheritParams pal_jama #' @param ... additional parameters for \code{\link[ggplot2]{discrete_scale}} #' #' @export scale_color_jama #' #' @importFrom ggplot2 discrete_scale #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @rdname scale_jama #' #' @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() scale_color_jama = function (palette = c('default'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('colour', 'jama', pal_jama(palette, alpha), ...) } #' @export scale_colour_jama #' @rdname scale_jama scale_colour_jama = scale_color_jama #' @export scale_fill_jama #' @importFrom ggplot2 discrete_scale #' @rdname scale_jama scale_fill_jama = function (palette = c('default'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('fill', 'jama', pal_jama(palette, alpha), ...) } ggsci/R/discrete-tron.R0000644000176200001440000000517313221611720014455 0ustar liggesusers#' Tron Legacy Color Palettes #' #' Color palettes inspired by the colors used in \emph{Tron Legacy}. #' #' @param palette Palette type. #' Currently there is one available option: \code{"legacy"} #' (7-color palette). #' @param alpha Transparency level, a real number in (0, 1]. #' See \code{alpha} in \code{\link[grDevices]{rgb}} for details. #' #' @export pal_tron #' #' @importFrom grDevices col2rgb rgb #' @importFrom scales manual_pal #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @examples #' library("scales") #' show_col(pal_tron("legacy")(7)) #' show_col(pal_tron("legacy", alpha = 0.6)(7)) pal_tron = function (palette = c('legacy'), alpha = 1) { palette = match.arg(palette) if (alpha > 1L | alpha <= 0L) stop('alpha must be in (0, 1]') raw_cols = ggsci_db$'tron'[[palette]] raw_cols_rgb = col2rgb(raw_cols) alpha_cols = rgb( raw_cols_rgb[1L, ], raw_cols_rgb[2L, ], raw_cols_rgb[3L, ], alpha = alpha * 255L, names = names(raw_cols), maxColorValue = 255L) manual_pal(unname(alpha_cols)) } #' Tron Legacy Color Scales #' #' See \code{\link{pal_tron}} for details. #' #' @inheritParams pal_tron #' @param ... additional parameters for \code{\link[ggplot2]{discrete_scale}} #' #' @export scale_color_tron #' #' @importFrom ggplot2 discrete_scale #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @rdname scale_tron #' #' @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() scale_color_tron = function (palette = c('legacy'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('colour', 'tron', pal_tron(palette, alpha), ...) } #' @export scale_colour_tron #' @rdname scale_tron scale_colour_tron = scale_color_tron #' @export scale_fill_tron #' @importFrom ggplot2 discrete_scale #' @rdname scale_tron scale_fill_tron = function (palette = c('legacy'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('fill', 'tron', pal_tron(palette, alpha), ...) } ggsci/R/discrete-simpsons.R0000644000176200001440000000506313221611720015344 0ustar liggesusers#' The Simpsons Color Palettes #' #' Color palettes inspired by the colors used in \emph{The Simpsons}. #' #' @param palette Palette type. #' Currently there is one available option: \code{"springfield"} #' (16-color palette). #' @param alpha Transparency level, a real number in (0, 1]. #' See \code{alpha} in \code{\link[grDevices]{rgb}} for details. #' #' @export pal_simpsons #' #' @importFrom grDevices col2rgb rgb #' @importFrom scales manual_pal #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @examples #' library("scales") #' show_col(pal_simpsons("springfield")(16)) #' show_col(pal_simpsons("springfield", alpha = 0.6)(16)) pal_simpsons = function (palette = c('springfield'), alpha = 1) { palette = match.arg(palette) if (alpha > 1L | alpha <= 0L) stop('alpha must be in (0, 1]') raw_cols = ggsci_db$'simpsons'[[palette]] raw_cols_rgb = col2rgb(raw_cols) alpha_cols = rgb( raw_cols_rgb[1L, ], raw_cols_rgb[2L, ], raw_cols_rgb[3L, ], alpha = alpha * 255L, names = names(raw_cols), maxColorValue = 255L) manual_pal(unname(alpha_cols)) } #' The Simpsons Color Scales #' #' See \code{\link{pal_simpsons}} for details. #' #' @inheritParams pal_simpsons #' @param ... additional parameters for \code{\link[ggplot2]{discrete_scale}} #' #' @export scale_color_simpsons #' #' @importFrom ggplot2 discrete_scale #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @rdname scale_simpsons #' #' @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() scale_color_simpsons = function (palette = c('springfield'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('colour', 'simpsons', pal_simpsons(palette, alpha), ...) } #' @export scale_colour_simpsons #' @rdname scale_simpsons scale_colour_simpsons = scale_color_simpsons #' @export scale_fill_simpsons #' @importFrom ggplot2 discrete_scale #' @rdname scale_simpsons scale_fill_simpsons = function (palette = c('springfield'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('fill', 'simpsons', pal_simpsons(palette, alpha), ...) } ggsci/R/discrete-lancet.R0000644000176200001440000000504013221611720014732 0ustar liggesusers#' Lancet Journal Color Palettes #' #' Color palettes inspired by plots in Lancet journals, #' such as \emph{Lancet Oncology}. #' #' @param palette Palette type. #' Currently there is one available option: \code{"lanonc"} #' (9-color palette inspired by \emph{Lancet Oncology}). #' @param alpha Transparency level, a real number in (0, 1]. #' See \code{alpha} in \code{\link[grDevices]{rgb}} for details. #' #' @export pal_lancet #' #' @importFrom grDevices col2rgb rgb #' @importFrom scales manual_pal #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @examples #' library("scales") #' show_col(pal_lancet("lanonc")(9)) #' show_col(pal_lancet("lanonc", alpha = 0.6)(9)) pal_lancet = function (palette = c('lanonc'), alpha = 1) { palette = match.arg(palette) if (alpha > 1L | alpha <= 0L) stop('alpha must be in (0, 1]') raw_cols = ggsci_db$'lancet'[[palette]] raw_cols_rgb = col2rgb(raw_cols) alpha_cols = rgb( raw_cols_rgb[1L, ], raw_cols_rgb[2L, ], raw_cols_rgb[3L, ], alpha = alpha * 255L, names = names(raw_cols), maxColorValue = 255L) manual_pal(unname(alpha_cols)) } #' Lancet Journal Color Scales #' #' See \code{\link{pal_lancet}} for details. #' #' @inheritParams pal_lancet #' @param ... additional parameters for \code{\link[ggplot2]{discrete_scale}} #' #' @export scale_color_lancet #' #' @importFrom ggplot2 discrete_scale #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @rdname scale_lancet #' #' @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() scale_color_lancet = function (palette = c('lanonc'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('colour', 'lancet', pal_lancet(palette, alpha), ...) } #' @export scale_colour_lancet #' @rdname scale_lancet scale_colour_lancet = scale_color_lancet #' @export scale_fill_lancet #' @importFrom ggplot2 discrete_scale #' @rdname scale_lancet scale_fill_lancet = function (palette = c('lanonc'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('fill', 'lancet', pal_lancet(palette, alpha), ...) } ggsci/R/discrete-jco.R0000644000176200001440000000471513221611720014247 0ustar liggesusers#' Journal of Clinical Oncology Color Palettes #' #' Color palette inspired by plots in \emph{Journal of Clinical Oncology}. #' #' @param palette Palette type. #' Currently there is one available option: \code{"default"} #' (10-color palette). #' @param alpha Transparency level, a real number in (0, 1]. #' See \code{alpha} in \code{\link[grDevices]{rgb}} for details. #' #' @export pal_jco #' #' @importFrom grDevices col2rgb rgb #' @importFrom scales manual_pal #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @examples #' library("scales") #' show_col(pal_jco("default")(10)) #' show_col(pal_jco("default", alpha = 0.6)(10)) pal_jco = function (palette = c('default'), alpha = 1) { palette = match.arg(palette) if (alpha > 1L | alpha <= 0L) stop('alpha must be in (0, 1]') raw_cols = ggsci_db$'jco'[[palette]] raw_cols_rgb = col2rgb(raw_cols) alpha_cols = rgb( raw_cols_rgb[1L, ], raw_cols_rgb[2L, ], raw_cols_rgb[3L, ], alpha = alpha * 255L, names = names(raw_cols), maxColorValue = 255L) manual_pal(unname(alpha_cols)) } #' Journal of Clinical Oncology Color Scales #' #' See \code{\link{pal_jco}} for details. #' #' @inheritParams pal_jco #' @param ... additional parameters for \code{\link[ggplot2]{discrete_scale}} #' #' @export scale_color_jco #' #' @importFrom ggplot2 discrete_scale #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @rdname scale_jco #' #' @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() scale_color_jco = function (palette = c('default'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('colour', 'jco', pal_jco(palette, alpha), ...) } #' @export scale_colour_jco #' @rdname scale_jco scale_colour_jco = scale_color_jco #' @export scale_fill_jco #' @importFrom ggplot2 discrete_scale #' @rdname scale_jco scale_fill_jco = function (palette = c('default'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('fill', 'jco', pal_jco(palette, alpha), ...) } ggsci/R/ggsci-package.R0000644000176200001440000000066713221611720014363 0ustar liggesusers#' Scientific Journal and Sci-Fi Themed Color Palettes for 'ggplot2' #' #' Scientific Journal and Sci-Fi Themed Color Palettes for 'ggplot2' #' #' Opened the vignette via \code{vignette("ggsci")}. #' #' \tabular{ll}{ Package: \tab ggsci\cr #' Type: \tab Package\cr #' License: \tab GPL-3\cr } #' #' @name ggsci-package #' @docType package #' @author Nan Xiao <\email{me@@nanx.me}> #' Miaozhu Li <\email{miaozhu.li@@duke.edu}> NULL ggsci/R/continuous-material.R0000644000176200001440000001123113221611720015665 0ustar liggesusers#' Material Design Color Palettes #' #' The Material Design color palettes. #' #' @param palette Palette type. #' There are 19 available options: #' \itemize{ #' \item \code{"red"} #' \item \code{"pink"} #' \item \code{"purple"} #' \item \code{"deep-purple"} #' \item \code{"indigo"} #' \item \code{"blue"} #' \item \code{"light-blue"} #' \item \code{"cyan"} #' \item \code{"teal"} #' \item \code{"green"} #' \item \code{"light-green"} #' \item \code{"lime"} #' \item \code{"yellow"} #' \item \code{"amber"} #' \item \code{"orange"}, #' \item \code{"deep-orange"} #' \item \code{"brown"} #' \item \code{"grey"} #' \item \code{"blue-grey"}} #' See the \href{https://material.io/guidelines/style/color.html}{material #' design color guidelines} for details. #' @param n Number of individual colors to be generated. #' @param alpha Transparency level, a real number in (0, 1]. #' See \code{alpha} in \code{\link[grDevices]{rgb}} for details. #' @param reverse Logical. Should the order of the colors be reversed? #' #' @export rgb_material #' #' @importFrom grDevices colorRamp rgb #' @importFrom scales manual_pal #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @references #' \url{https://material.io/guidelines/style/color.html} #' #' @examples #' library("scales") #' show_col(pal_material("indigo")(10)) #' show_col(pal_material("indigo", n = 30, alpha = 0.6, reverse = TRUE)(30)) rgb_material = function (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) { palette = match.arg(palette) if (alpha > 1L | alpha <= 0L) stop('alpha must be in (0, 1]') raw_cols = ggsci_db$'material'[[palette]] func_cols = colorRamp(raw_cols, space = 'Lab', interpolate = 'spline') mat_cols = func_cols(seq(0L, 1L, length.out = n)) alpha_cols = rgb( mat_cols[, 1L], mat_cols[, 2L], mat_cols[, 3L], alpha = alpha * 255L, maxColorValue = 255L) if (reverse) alpha_cols = rev(alpha_cols) alpha_cols } #' Material Design Color Palettes #' #' The Material Design color palettes. #' #' @inheritParams rgb_material #' #' @export pal_material #' #' @importFrom scales manual_pal #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{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)) pal_material = function (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) { palette = match.arg(palette) alpha_cols = rgb_material(palette, n, alpha, reverse) manual_pal(unname(alpha_cols)) } #' Material Design Color Palettes #' #' See \code{\link{pal_material}} for details. #' #' @inheritParams pal_material #' @param ... additional parameters for \code{\link[ggplot2]{discrete_scale}} #' #' @export scale_color_material #' #' @importFrom ggplot2 scale_color_gradientn #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @rdname scale_material #' #' @examples #' library("ggplot2") #' library("reshape2") #' data("mtcars") #' #' cor = abs(cor(mtcars)) #' cor_melt = melt(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") scale_color_material = function (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, ...) { palette = match.arg(palette) scale_color_gradientn(colours = rgb_material( palette, n = 512, alpha = alpha, reverse = reverse), ...) } #' @export scale_colour_material #' @rdname scale_material scale_colour_material = scale_color_material #' @export scale_fill_material #' @importFrom ggplot2 scale_fill_gradientn #' @rdname scale_material scale_fill_material = function (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, ...) { palette = match.arg(palette) scale_fill_gradientn(colours = rgb_material( palette, n = 512, alpha = alpha, reverse = reverse), ...) } ggsci/R/discrete-npg.R0000644000176200001440000000476013221611720014260 0ustar liggesusers#' NPG Journal Color Palettes #' #' Color palettes inspired by plots in journals published by #' Nature Publishing Group, such as \emph{Nature Reviews Cancer}. #' #' @param palette Palette type. #' Currently there is one available option: \code{"nrc"} #' (10-color palette inspired by \emph{Nature Reviews Cancer}). #' @param alpha Transparency level, a real number in (0, 1]. #' See \code{alpha} in \code{\link[grDevices]{rgb}} for details. #' #' @export pal_npg #' #' @importFrom grDevices col2rgb rgb #' @importFrom scales manual_pal #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @examples #' library("scales") #' show_col(pal_npg("nrc")(10)) #' show_col(pal_npg("nrc", alpha = 0.6)(10)) pal_npg = function (palette = c('nrc'), alpha = 1) { palette = match.arg(palette) if (alpha > 1L | alpha <= 0L) stop('alpha must be in (0, 1]') raw_cols = ggsci_db$'npg'[[palette]] raw_cols_rgb = col2rgb(raw_cols) alpha_cols = rgb( raw_cols_rgb[1L, ], raw_cols_rgb[2L, ], raw_cols_rgb[3L, ], alpha = alpha * 255L, names = names(raw_cols), maxColorValue = 255L) manual_pal(unname(alpha_cols)) } #' NPG Journal Color Scales #' #' See \code{\link{pal_npg}} for details. #' #' @inheritParams pal_npg #' @param ... additional parameters for \code{\link[ggplot2]{discrete_scale}} #' #' @export scale_color_npg #' #' @importFrom ggplot2 discrete_scale #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @rdname scale_npg #' #' @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() scale_color_npg = function (palette = c('nrc'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('colour', 'npg', pal_npg(palette, alpha), ...) } #' @export scale_colour_npg #' @rdname scale_npg scale_colour_npg = scale_color_npg #' @export scale_fill_npg #' @importFrom ggplot2 discrete_scale #' @rdname scale_npg scale_fill_npg = function (palette = c('nrc'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('fill', 'npg', pal_npg(palette, alpha), ...) } ggsci/R/discrete-aaas.R0000644000176200001440000000512513221611720014375 0ustar liggesusers#' AAAS Journal Color Palettes #' #' Color palettes inspired by plots in journals published by #' American Association for the Advancement of Science (AAAS), #' such as \emph{Science} and \emph{Science Translational Medicine}. #' #' @param palette Palette type. #' Currently there is one available option: \code{"default"} #' (10-color palette inspired by \emph{Science}). #' @param alpha Transparency level, a real number in (0, 1]. #' See \code{alpha} in \code{\link[grDevices]{rgb}} for details. #' #' @export pal_aaas #' #' @importFrom grDevices col2rgb rgb #' @importFrom scales manual_pal #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @examples #' library("scales") #' show_col(pal_aaas("default")(10)) #' show_col(pal_aaas("default", alpha = 0.6)(10)) pal_aaas = function (palette = c('default'), alpha = 1) { palette = match.arg(palette) if (alpha > 1L | alpha <= 0L) stop('alpha must be in (0, 1]') raw_cols = ggsci_db$'aaas'[[palette]] raw_cols_rgb = col2rgb(raw_cols) alpha_cols = rgb( raw_cols_rgb[1L, ], raw_cols_rgb[2L, ], raw_cols_rgb[3L, ], alpha = alpha * 255L, names = names(raw_cols), maxColorValue = 255L) manual_pal(unname(alpha_cols)) } #' AAAS Journal Color Scales #' #' See \code{\link{pal_aaas}} for details. #' #' @inheritParams pal_aaas #' @param ... additional parameters for \code{\link[ggplot2]{discrete_scale}} #' #' @export scale_color_aaas #' #' @importFrom ggplot2 discrete_scale #' #' @author Nan Xiao <\email{me@@nanx.me}> | #' <\href{https://nanx.me}{https://nanx.me}> #' #' @rdname scale_aaas #' #' @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() scale_color_aaas = function (palette = c('default'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('colour', 'aaas', pal_aaas(palette, alpha), ...) } #' @export scale_colour_aaas #' @rdname scale_aaas scale_colour_aaas = scale_color_aaas #' @export scale_fill_aaas #' @importFrom ggplot2 discrete_scale #' @rdname scale_aaas scale_fill_aaas = function (palette = c('default'), alpha = 1, ...) { palette = match.arg(palette) discrete_scale('fill', 'aaas', pal_aaas(palette, alpha), ...) } ggsci/vignettes/0000755000176200001440000000000013276174761013374 5ustar liggesusersggsci/vignettes/ggsci.css0000644000176200001440000000734713221611720015172 0ustar liggesusersbody { background-color: #fff; margin: 1em auto; max-width: 800px; overflow: visible; padding-left: 2em; padding-right: 2em; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; font-size: 16px; line-height: 24px; color: #333; } h1.title { text-align: center; font-weight: 600; } h4.author { text-align: center; } h4.date { text-align: center; } #TOC { clear: both; margin: 0 0 10px 0px; padding: 15px; width: 770px; border: 1px solid #CCCCCC; border-radius: 5px; background-color: #f6f6f6; font-size: 16px; line-height: 1.5; } #TOC .toctitle { font-weight: bold; font-size: 16px; margin-left: 5px; } #TOC ul { padding-left: 50px; margin-left: -1.5em; margin-top: 5px; margin-bottom: 5px; } #TOC ul ul { margin-left: -2em; } #TOC li { line-height: 20px; } table { margin: 1em auto; border-width: 1px; border-color: #DDDDDD; border-style: outset; border-collapse: collapse; } table th { border-width: 2px; padding: 5px; border-style: inset; } table td { border-width: 1px; border-style: inset; line-height: 18px; padding: 5px 5px; } table, table th, table td { border-left-style: none; border-right-style: none; } table thead, table tr.even { background-color: #f7f7f7; } p { margin: 0.5em 0; } blockquote { background-color: #f6f6f6; padding: 1em 2em; } hr { border-style: solid; border: none; border-top: 1px solid #777; margin: 28px 0; } dl { margin-left: 0; } dl dd { margin-bottom: 13px; margin-left: 13px; } dl dt { font-weight: bold; } ul { margin-top: 0; } ul li { list-style: circle outside; } ul ul { margin-bottom: 0; } pre, code { background-color: #f7f7f7; border-radius: 5px; color: #333; white-space: pre-wrap; /* Wrap long lines */ } pre { border-radius: 5px; margin: 5px 0px 10px 0px; padding: 10px; } pre:not([class]) { background-color: #f7f7f7; } code { font-family: Menlo, Monaco, "Lucida Console", Consolas, "Courier New", monospace; font-size: 85%; } p>code, li>code { padding: 2px 0px; } div.figure { text-align: center; } img { background-color: #FFFFFF; padding: 2px; border: 1px solid #DDDDDD; border-radius: 3px; border: 1px solid #CCCCCC; margin: 0 5px; } h1 { margin-top: 25px; font-size: 32px; line-height: 40px; font-weight: 600; } h2 { border-bottom: 2px solid #f7f7f7; padding-top: 10px; padding-bottom: 2px; font-size: 145%; } h3 { border-bottom: 1px solid #f7f7f7; padding-top: 10px; font-size: 120%; } h4 { margin-left: 8px; font-size: 110%; font-weight: normal; } em { font-style: normal; } emph { font-style: oblique; } h5, h6 { border-bottom: 1px solid #ccc; font-size: 105%; } a { color: #123d79; text-decoration: none; } a:hover { color: #007CC3; } a:visited { color: #581858; } a:visited:hover { color: #007CC3; } /* code highlight theme: highlight.js - tomorrow http://jmblog.github.io/color-themes-for-highlightjs/tomorrow/ */ code>span.kw { color: #4271ae; } /* Keyword */ code>span.dt { color: #c82829; } /* DataType */ code>span.dv { color: #f5871f; } /* DecVal (decimal values) */ code>span.bn { color: #718c00; } /* BaseN */ code>span.fl { color: #718c00; } /* Float */ code>span.ch { color: #718c00; } /* Char */ code>span.st { color: #718c00; } /* String */ code>span.co { color: #8e908c; } /* Comment */ code>span.ot { color: #4d4d4c; } /* OtherToken */ code>span.al { color: #ff0000; } /* AlertToken */ code>span.fu { color: #4271ae; } /* Function calls */ code>span.er { color: #a61717; } /* ErrorTok */ /* centering images */ img { display: block; margin: 0 auto; }ggsci/vignettes/ggsci.Rmd0000644000176200001440000004511413276174703015135 0ustar liggesusers--- title: "Scientific Journal and Sci-Fi Themed
Color Palettes for ggplot2" author: "Nan Xiao <>
Miaozhu Li <>" date: "`r Sys.Date()`" output: rmarkdown::html_vignette: toc: true number_sections: true css: ggsci.css vignette: > %\VignetteEngine{knitr::rmarkdown} %\VignetteIndexEntry{Scientific Journal and Sci-Fi Themed Color Palettes for ggplot2} --- # Introduction > My eyes were finally opened and I understood nature. > > I learned at the same time to love it. > > --- Claude Monet `ggsci` offers a collection of high-quality color palettes inspired by colors used in scientific journals, data visualization libraries, science fiction movies, and TV shows. The color palettes in `ggsci` are available as `ggplot2` scales. For all the color palettes, the corresponding scales are named as: * `scale_color_palname()` * `scale_fill_palname()` We also provided aliases, such as `scale_colour_palname()` for `scale_color_palname()`. All available color palettes are summarized in the table below. +-----------------+------------------------------+--------------------------------+----------------------+ | Name | Scales | Palette Types | Palette Generator | +=================+==============================+================================+======================+ | NPG | `scale_color_npg()` | `"nrc"` | `pal_npg()` | | | `scale_fill_npg()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | AAAS | `scale_color_aaas()` | `"default"` | `pal_aaas()` | | | `scale_fill_aaas()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | NEJM | `scale_color_nejm()` | `"default"` | `pal_nejm()` | | | `scale_fill_nejm()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | Lancet | `scale_color_lancet()` | `"lanonc"` | `pal_lancet()` | | | `scale_fill_lancet()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | JAMA | `scale_color_jama()` | `"default"` | `pal_jama()` | | | `scale_fill_jama()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | JCO | `scale_color_jco()` | `"default"` | `pal_jco()` | | | `scale_fill_jco()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | UCSCGB | `scale_color_ucscgb()` | `"default"` | `pal_ucscgb()` | | | `scale_fill_ucscgb()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | D3 | `scale_color_d3()`
| `"category10"` | `pal_d3()` | | | `scale_fill_d3()` | `"category20"` | | | | | `"category20b"` | | | | | `"category20c"` | | +-----------------+------------------------------+--------------------------------+----------------------+ | LocusZoom | `scale_color_locuszoom()` | `"default"` | `pal_locuszoom()` | | | `scale_fill_locuszoom()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | IGV | `scale_color_igv()` | `"default"`
| `pal_igv()` | | | `scale_fill_igv()` | `"alternating"` | | +-----------------+------------------------------+--------------------------------+----------------------+ | UChicago | `scale_color_uchicago()` | `"default"`
| `pal_uchicago()` | | | `scale_fill_uchicago()` | `"light"`
| | | | | `"dark"` | | +-----------------+------------------------------+--------------------------------+----------------------+ | Star Trek | `scale_color_startrek()` | `"uniform"` | `pal_startrek()` | | | `scale_fill_startrek()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | Tron Legacy | `scale_color_tron()` | `"legacy"` | `pal_tron()` | | | `scale_fill_tron()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | Futurama | `scale_color_futurama()` | `"planetexpress"` | `pal_futurama()` | | | `scale_fill_futurama()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | Rick and Morty | `scale_color_rickandmorty()` | `"schwifty"` | `pal_rickandmorty()` | | | `scale_fill_rickandmorty()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | The Simpsons | `scale_color_simpsons()` | `"springfield"` | `pal_simpsons()` | | | `scale_fill_simpsons()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | GSEA | `scale_color_gsea()` | `"default"` | `pal_gsea()` | | | `scale_fill_gsea()` | | | +-----------------+------------------------------+--------------------------------+----------------------+ | Material Design | `scale_color_material()` | `"red"` `"pink"`
| `pal_material()` | | | `scale_fill_material()` | `"purple"` `"deep-purple"`
| | | | | `"indigo"` `"blue"`
| | | | | `"light-blue"` `"cyan"`
| | | | | `"teal"` `"green"`
| | | | | `"light-green"` `"lime"`
| | | | | `"yellow"` `"amber"`
| | | | | `"orange"` `"deep-orange"`
| | | | | `"brown"` `"grey"`
| | | | | `"blue-grey"` | | +-----------------+------------------------------+--------------------------------+----------------------+ # Discrete Color Palettes We will use scatterplots with smooth curves, and bar plots to demonstrate the discrete color palettes in `ggsci`. ```{r} library("ggsci") library("ggplot2") library("gridExtra") 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.05, 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() ``` ## NPG The NPG palette is inspired by the plots in the journals published by Nature Publishing Group: ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_npg = p1 + scale_color_npg() p2_npg = p2 + scale_fill_npg() grid.arrange(p1_npg, p2_npg, ncol = 2) ``` ## AAAS The AAAS palette is inspired by the plots in the journals published by American Association for the Advancement of Science: ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_aaas = p1 + scale_color_aaas() p2_aaas = p2 + scale_fill_aaas() grid.arrange(p1_aaas, p2_aaas, ncol = 2) ``` ## NEJM The NEJM palette is inspired by the plots in The New England Journal of Medicine: ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_nejm = p1 + scale_color_nejm() p2_nejm = p2 + scale_fill_nejm() grid.arrange(p1_nejm, p2_nejm, ncol = 2) ``` ## Lancet The Lancet palette is inspired by the plots in Lancet journals, such as Lancet Oncology: ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_lancet = p1 + scale_color_lancet() p2_lancet = p2 + scale_fill_lancet() grid.arrange(p1_lancet, p2_lancet, ncol = 2) ``` ## JAMA The JAMA palette is inspired by the plots in The Journal of the American Medical Association: ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_jama = p1 + scale_color_jama() p2_jama = p2 + scale_fill_jama() grid.arrange(p1_jama, p2_jama, ncol = 2) ``` ## JCO The JCO palette is inspired by the the plots in Journal of Clinical Oncology: ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_jco = p1 + scale_color_jco() p2_jco = p2 + scale_fill_jco() grid.arrange(p1_jco, p2_jco, ncol = 2) ``` ## UCSCGB The UCSCGB palette is from the colors used by [UCSC Genome Browser](https://genome.ucsc.edu) for representing chromosomes. This palette has been intensively used in visualizations produced by [Circos](http://circos.ca). ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_ucscgb = p1 + scale_color_ucscgb() p2_ucscgb = p2 + scale_fill_ucscgb() grid.arrange(p1_ucscgb, p2_ucscgb, ncol = 2) ``` ## D3 The D3 palette is from the categorical colors used by [D3.js](https://d3js.org) (version 3.x and before). There are four palette types (`category10`, `category20`, `category20b`, `category20c`) available. ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_d3 = p1 + scale_color_d3() p2_d3 = p2 + scale_fill_d3() grid.arrange(p1_d3, p2_d3, ncol = 2) ``` ## LocusZoom The LocusZoom palette is based on the colors used by [LocusZoom](http://locuszoom.org/). ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_locuszoom = p1 + scale_color_locuszoom() p2_locuszoom = p2 + scale_fill_locuszoom() grid.arrange(p1_locuszoom, p2_locuszoom, ncol = 2) ``` ## IGV The IGV palette is from the colors used by [Integrative Genomics Viewer](http://software.broadinstitute.org/software/igv/) for representing chromosomes. There are two palette types (`default`, `alternating`) available. ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_igv_default = p1 + scale_color_igv() p2_igv_default = p2 + scale_fill_igv() grid.arrange(p1_igv_default, p2_igv_default, ncol = 2) ``` ## UChicago The UChicago palette is based on [the colors](https://news.uchicago.edu/sites/default/files/attachments/_uchicago.identity.guidelines.pdf) used by the University of Chicago. There are three palette types (`default`, `light`, `dark`) available. ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_uchicago = p1 + scale_color_uchicago() p2_uchicago = p2 + scale_fill_uchicago() grid.arrange(p1_uchicago, p2_uchicago, ncol = 2) ``` ## Star Trek This palette is inspired by the (uniform) colors in Star Trek: ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_startrek = p1 + scale_color_startrek() p2_startrek = p2 + scale_fill_startrek() grid.arrange(p1_startrek, p2_startrek, ncol = 2) ``` ## Tron Legacy This palette is inspired by the colors used in Tron Legacy. It is suitable for displaying data when using a dark theme: ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_tron = p1 + theme_dark() + theme( panel.background = element_rect(fill = "#2D2D2D"), legend.key = element_rect(fill = "#2D2D2D")) + scale_color_tron() p2_tron = p2 + theme_dark() + theme( panel.background = element_rect(fill = "#2D2D2D")) + scale_fill_tron() grid.arrange(p1_tron, p2_tron, ncol = 2) ``` ## Futurama This palette is inspired by the colors used in the TV show Futurama: ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_futurama = p1 + scale_color_futurama() p2_futurama = p2 + scale_fill_futurama() grid.arrange(p1_futurama, p2_futurama, ncol = 2) ``` ## Rick and Morty This palette is inspired by the colors used in the TV show Rick and Morty: ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_rickandmorty = p1 + scale_color_rickandmorty() p2_rickandmorty = p2 + scale_fill_rickandmorty() grid.arrange(p1_rickandmorty, p2_rickandmorty, ncol = 2) ``` ## The Simpsons This palette is inspired by the colors used in the TV show The Simpsons: ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p1_simpsons = p1 + scale_color_simpsons() p2_simpsons = p2 + scale_fill_simpsons() grid.arrange(p1_simpsons, p2_simpsons, ncol = 2) ``` # Continuous Color Palettes We will use a correlation matrix visualization (a special type of heatmap) to demonstrate the continuous color palettes in `ggsci`. ```{r} library("reshape2") data("mtcars") cor = cor(unname(cbind(mtcars, mtcars, mtcars, mtcars))) cor_melt = melt(cor) p3 = ggplot(cor_melt, aes(x = Var1, y = Var2, fill = value)) + geom_tile(colour = "black", size = 0.3) + theme_bw() + theme(axis.title.x = element_blank(), axis.title.y = element_blank()) ``` ## GSEA The GSEA palette (continuous) is inspired by the heatmaps generated by [GSEA GenePattern](https://software.broadinstitute.org/cancer/software/genepattern/). ```{r, fig.width = 10.67, fig.height = 4, out.width = 800, out.height = 300, dpi = 150} p3_gsea = p3 + scale_fill_gsea() p3_gsea_inv = p3 + scale_fill_gsea(reverse = TRUE) grid.arrange(p3_gsea, p3_gsea_inv, ncol = 2) ``` ## Material Design The Material Design color palettes are from the [material design color guidelines](https://material.io/guidelines/style/color.html). We generate a random matrix first: ```{r} library("reshape2") set.seed(42) k = 9 x = diag(k) x[upper.tri(x)] = runif(sum(1:(k - 1)), 0, 1) x_melt = melt(x) p4 = ggplot(x_melt, aes(x = Var1, y = Var2, fill = value)) + geom_tile(colour = "black", size = 0.3) + scale_x_continuous(expand = c(0, 0)) + scale_y_continuous(expand = c(0, 0)) + theme_bw() + theme( legend.position = "none", plot.background = element_blank(), axis.line = element_blank(), axis.ticks = element_blank(), axis.text.x = element_blank(), axis.text.y = element_blank(), axis.title.x = element_blank(), axis.title.y = element_blank(), panel.background = element_blank(), panel.border = element_blank(), panel.grid.major = element_blank(), panel.grid.minor = element_blank()) ``` Plot the matrix with the 19 material design color palettes: ```{r, fig.width = 10.67, fig.height = 7.12, out.width = 800, out.height = 533, dpi = 150} grid.arrange( p4 + scale_fill_material("red"), p4 + scale_fill_material("pink"), p4 + scale_fill_material("purple"), p4 + scale_fill_material("deep-purple"), p4 + scale_fill_material("indigo"), p4 + scale_fill_material("blue"), p4 + scale_fill_material("light-blue"), p4 + scale_fill_material("cyan"), p4 + scale_fill_material("teal"), p4 + scale_fill_material("green"), p4 + scale_fill_material("light-green"), p4 + scale_fill_material("lime"), p4 + scale_fill_material("yellow"), p4 + scale_fill_material("amber"), p4 + scale_fill_material("orange"), p4 + scale_fill_material("deep-orange"), p4 + scale_fill_material("brown"), p4 + scale_fill_material("grey"), p4 + scale_fill_material("blue-grey"), ncol = 6) ``` From the figure above, we can see that even though an identical matrix was visualized by all plots, some palettes are more preferrable than the others because our eyes are more sensitive to the changes of their saturation levels. # Non-ggplot2 Graphics To apply the color palettes in `ggsci` to other graphics systems (such as base graphics and lattice graphics), simply use the palette generator functions in the table above. For example: ```{r, fig.width = 6.67, fig.height = 6.67, out.width = 500, out.height = 500, dpi = 150} mypal = pal_npg("nrc", alpha = 0.7)(9) mypal library("scales") show_col(mypal) ``` You will be able to use the generated hex color codes for such graphics systems accordingly. The transparent level of the entire palette is easily adjustable via the argument `"alpha"` in every generator or scale function. # Discussion Please note some of the palettes might not be the best choice for certain purposes, such as color-blind safe, photocopy safe, or print friendly. If you do have such considerations, you might want to check out color palettes like [ColorBrewer](http://colorbrewer2.org) and [viridis](https://cran.r-project.org/package=viridis). The color palettes in this package are solely created for research purposes. The authors are not responsible for the usage of such palettes. ggsci/README.md0000644000176200001440000000561013274177012012633 0ustar liggesusers# ggsci logo [![Build Status](https://travis-ci.org/road2stat/ggsci.svg?branch=master)](https://travis-ci.org/road2stat/ggsci) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/road2stat/ggsci?branch=master&svg=true)](https://ci.appveyor.com/project/road2stat/ggsci) [![CRAN Version](https://www.r-pkg.org/badges/version/ggsci)](https://cran.r-project.org/package=ggsci) [![Downloads from the RStudio CRAN mirror](https://cranlogs.r-pkg.org/badges/ggsci)](https://cran.r-project.org/package=ggsci) `ggsci` offers a collection of `ggplot2` color palettes inspired by scientific journals, data visualization libraries, science fiction movies, and TV shows. ## Installation Install `ggsci` from CRAN: ```r install.packages("ggsci") ``` Or try the development version on GitHub: ```r # install.packages("devtools") devtools::install_github("road2stat/ggsci") ``` [Browse the vignette](https://nanx.me/ggsci/articles/ggsci.html) (or open with `vignette("ggsci")` in R) for a quick-start guide. ## Gallery ### NPG npg ### AAAS aaas ### NEJM nejm ### Lancet lancet ### JAMA jama ### JCO jco ### UCSCGB ucscgb ### D3 d3 ### LocusZoom locuszoom ### IGV igv ### UChicago uchicago ### Star Trek startrek ### Tron Legacy tron ### Futurama futurama ### Rick and Morty rickandmorty ### The Simpsons simpsons ### GSEA gsea ### Material Design material ## Contribute To contribute to this project, please take a look at the [Contributing Guidelines](CONTRIBUTING.md) first. Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md). By participating in this project you agree to abide by its terms. ggsci/MD50000644000176200001440000000717313276211255011672 0ustar liggesuserse2aaeda6812a8eeacddff95f89f2c5b1 *DESCRIPTION d32239bcb673463ab874e80d47fae504 *LICENSE c3cd2a816603e8c868f62f5f50efc9ca *NAMESPACE a742a8637e1b00fddf5bffcc90b8e01d *NEWS.md 41f514566fb3eae80f254a5119458dbe *R/continuous-gsea.R 30a9b5e2e56ed6f2080e80975591ffbd *R/continuous-material.R 96380b3f35ed7dc05c20ead63531f8b9 *R/discrete-aaas.R 7189cfe42f6ebfbb30c0e8d07524b00d *R/discrete-d3.R 98b3391151eabdc19210393d1f119203 *R/discrete-futurama.R e1e1aba76cdb28d9a489e04114d93f7c *R/discrete-igv.R e068a343acdfd5a5eb7744d92ad75e54 *R/discrete-jama.R 29d1a0a45bfd86c7e2ba56303fc7e6e6 *R/discrete-jco.R 20351b67553fdda5d6c546b86b6f33f6 *R/discrete-lancet.R fdc05708de8d037d2a2e2aa4f5f127b4 *R/discrete-locuszoom.R 168d4e9c14e128be82f9573edb3d5c29 *R/discrete-nejm.R a99846259fd582dcc635694bed132ac0 *R/discrete-npg.R a2a5d1a5b441ba14bdc27e91e50acb60 *R/discrete-rickandmorty.R a530cff1f40fc6ffc95eb1c433148a76 *R/discrete-simpsons.R 86b6fd916a4209087b744ab841034893 *R/discrete-startrek.R e89ffc8c9f485c7f838bc64745c7f6fc *R/discrete-tron.R 3a78f89a0072385b6c4f89d232400ea8 *R/discrete-uchicago.R 781276dfa1d1ae669dbf3d98c0f17965 *R/discrete-ucscgb.R 5750a02379fc79a4adfefa8c21937292 *R/ggsci-package.R 18799734d6403692e222d5ada6a5b6c9 *R/sysdata.rda 1447f1e289d9b2c3a52511e604e70210 *README.md a3c3e4b305e798286d92ddb9f8a6fafa *TODO c154242ca715432216e5dd7f3c19c1a2 *build/vignette.rds e9b4324c261a9062418f33843389fd0a *inst/doc/ggsci.R 30caf9cf5816367721d7f13baee97145 *inst/doc/ggsci.Rmd c5f2e58209a582817946e55873b21782 *inst/doc/ggsci.html 1aa15c941d978e8f4b390862dd4145ae *man/ggsci-package.Rd e115727836619eb0fddf0e07efb708a4 *man/pal_aaas.Rd 0d6506ff1967ac03addb50b8b5168d1a *man/pal_d3.Rd 00d1a3608b1f17d9b7928c24a923bcee *man/pal_futurama.Rd eddb89aa001c4f8949a3bbf32cb65615 *man/pal_gsea.Rd 7593f9620a929fd41afa837b4d657502 *man/pal_igv.Rd 7f533016c53bd9dc580223372f213a87 *man/pal_jama.Rd ece84cac58180b0f6eb8b9188aae1a78 *man/pal_jco.Rd 5f12831ba10e827646465a59c193946d *man/pal_lancet.Rd 741db6e41a2e486e8d9262e6743fdc20 *man/pal_locuszoom.Rd b02f28f7be00e877897d27a7d95f2933 *man/pal_material.Rd 1d710cd2b9c8763cc5bc08b94326a285 *man/pal_nejm.Rd f46a5ec69258c17e9305d6cb5ee63262 *man/pal_npg.Rd d3a7609644a6bcfe364502fc5a51bed7 *man/pal_rickandmorty.Rd 108625bbea0528dabc5b0d7e9b5453cb *man/pal_simpsons.Rd faa67670118394a23079fecbaf30f25b *man/pal_startrek.Rd 28675b5064c5a1b40352ede6833bc680 *man/pal_tron.Rd 26713652b107a5a4e3a3749de41b59a6 *man/pal_uchicago.Rd 921de3bd18699344d43eebb6bba9a2a8 *man/pal_ucscgb.Rd 0d9792ab50f2d06b8eff611b89f88c86 *man/rgb_gsea.Rd 900bf0b0bfd23e7c6df3e93dc91cd0dd *man/rgb_material.Rd 6da74b70684bd98f81f6f658f924e078 *man/scale_aaas.Rd d2466524a81e98e73f398fb1a780a564 *man/scale_d3.Rd 1d909b9e1020c594ee88a6e9e610139e *man/scale_futurama.Rd 77baaca45e073202e210ad365a16c4de *man/scale_gsea.Rd e1c1bd7b99c4da0d87ea281cdbba0418 *man/scale_igv.Rd f664041d4caec62cfcbebd68c272a793 *man/scale_jama.Rd 09295717ad896e83b0ce10719b0c0352 *man/scale_jco.Rd 057edbf2c5e4976c80b64374092a84f3 *man/scale_lancet.Rd eda2e609c0b4bba18a86ba02a5f91599 *man/scale_locuszoom.Rd 6b6f421b329f18212919254faa65056d *man/scale_material.Rd 7a6ecd47c4140505cffedc482f0353a4 *man/scale_nejm.Rd bb5a1f03fccab8ea36719c213c09cd76 *man/scale_npg.Rd ab81186f48bc447f8e4cfa85f293c706 *man/scale_rickandmorty.Rd 2d80a65a2a293fcf17117acff2be85c4 *man/scale_simpsons.Rd 8af48332182b74cd36f915a776a826e3 *man/scale_startrek.Rd 39541dfb0dcdb505b28eceac79647b03 *man/scale_tron.Rd f9015198e52a9083e53064b9844a2365 *man/scale_uchicago.Rd 0039d221c30c26f4462662b65aa3f4bf *man/scale_ucscgb.Rd 30caf9cf5816367721d7f13baee97145 *vignettes/ggsci.Rmd cdfb3ea764117b9f87b0df545e109f82 *vignettes/ggsci.css ggsci/build/0000755000176200001440000000000013276174761012463 5ustar liggesusersggsci/build/vignette.rds0000644000176200001440000000036213276174761015023 0ustar liggesusersmQ 0 @|;;Eԃײfе7\tKCDGןNP=߰(Lے;.EFWd)N1=KNZjC7LPsg\st*Ö>ӯ2Jh+VBb@&}dY3h{TH}&I[ۺ~> gh(d{hęeqn~ 6ggsci/DESCRIPTION0000644000176200001440000000211213276211255013054 0ustar liggesusersPackage: ggsci Type: Package Title: Scientific Journal and Sci-Fi Themed Color Palettes for 'ggplot2' Version: 2.9 Authors@R: c( person("Nan", "Xiao", email = "me@nanx.me", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-0250-5673")), person("Miaozhu", "Li", email = "miaozhu.li@duke.edu", role = "ctb")) Maintainer: Nan Xiao Description: A collection of 'ggplot2' color palettes inspired by plots in scientific journals, data visualization libraries, science fiction movies, and TV shows. License: GPL-3 | file LICENSE LazyData: TRUE VignetteBuilder: knitr URL: https://nanx.me/ggsci/, https://github.com/road2stat/ggsci BugReports: https://github.com/road2stat/ggsci/issues Depends: R (>= 3.0.2) Imports: grDevices, scales, ggplot2 (>= 2.0.0) Suggests: knitr, rmarkdown, gridExtra, reshape2 Encoding: UTF-8 RoxygenNote: 6.0.1.9000 NeedsCompilation: no Packaged: 2018-05-14 02:52:33 UTC; nanx Author: Nan Xiao [aut, cre] (), Miaozhu Li [ctb] Repository: CRAN Date/Publication: 2018-05-14 04:38:05 UTC ggsci/man/0000755000176200001440000000000013221611720012114 5ustar liggesusersggsci/man/scale_igv.Rd0000644000176200001440000000312313221611720014336 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-igv.R \name{scale_color_igv} \alias{scale_color_igv} \alias{scale_colour_igv} \alias{scale_fill_igv} \title{Integrative Genomics Viewer (IGV) Color Scales} \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{ \item{palette}{Palette type. There are two available options: \code{"default"} (51-color palette); \code{"alternating"} (2-color palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} \item{...}{additional parameters for \code{\link[ggplot2]{discrete_scale}}} } \description{ See \code{\link{pal_igv}} for details. } \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)) } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/ggsci-package.Rd0000644000176200001440000000104413221611720015067 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/ggsci-package.R \docType{package} \name{ggsci-package} \alias{ggsci-package} \title{Scientific Journal and Sci-Fi Themed Color Palettes for 'ggplot2'} \description{ Scientific Journal and Sci-Fi Themed Color Palettes for 'ggplot2' } \details{ Opened the vignette via \code{vignette("ggsci")}. \tabular{ll}{ Package: \tab ggsci\cr Type: \tab Package\cr License: \tab GPL-3\cr } } \author{ Nan Xiao <\email{me@nanx.me}> Miaozhu Li <\email{miaozhu.li@duke.edu}> } ggsci/man/pal_d3.Rd0000644000176200001440000000200413221611720013541 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-d3.R \name{pal_d3} \alias{pal_d3} \title{D3.js Color Palettes} \usage{ pal_d3(palette = c("category10", "category20", "category20b", "category20c"), alpha = 1) } \arguments{ \item{palette}{Palette type. There are 4 available options: \code{"category10"} (10-color palette); \code{"category20"} (20-color palette); \code{"category20b"} (20-color palette); \code{"category20c"} (20-color palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} } \description{ Color palettes based on the colors used by D3.js. } \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)) } \references{ \url{https://github.com/d3/d3-3.x-api-reference/blob/master/Ordinal-Scales.md} } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/pal_ucscgb.Rd0000644000176200001440000000135613221611720014512 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-ucscgb.R \name{pal_ucscgb} \alias{pal_ucscgb} \title{UCSC Genome Browser Color Palette} \usage{ pal_ucscgb(palette = c("default"), alpha = 1) } \arguments{ \item{palette}{Palette type. Currently there is one available option: \code{"default"} (26-color palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} } \description{ Color palette from UCSC Genome Browser chromosome colors. } \examples{ library("scales") show_col(pal_ucscgb("default")(26)) show_col(pal_ucscgb("default", alpha = 0.6)(26)) } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/pal_igv.Rd0000644000176200001440000000177213221611720014033 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-igv.R \name{pal_igv} \alias{pal_igv} \title{Integrative Genomics Viewer (IGV) Color Palettes} \usage{ pal_igv(palette = c("default", "alternating"), alpha = 1) } \arguments{ \item{palette}{Palette type. There are two available options: \code{"default"} (51-color palette); \code{"alternating"} (2-color palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} } \description{ Color palettes based on the colors used by Integrative Genomics Viewer (IGV). } \examples{ library("scales") show_col(pal_igv("default")(51)) show_col(pal_igv("alternating")(2)) } \references{ James T. Robinson, Helga Thorvaldsd\'{o}ttir, Wendy Winckler, Mitchell Guttman, Eric S. Lander, Gad Getz, Jill P. Mesirov. Integrative Genomics Viewer. \emph{Nature Biotechnology} 29, 24--26 (2011). } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/pal_simpsons.Rd0000644000176200001440000000141513221611720015113 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-simpsons.R \name{pal_simpsons} \alias{pal_simpsons} \title{The Simpsons Color Palettes} \usage{ pal_simpsons(palette = c("springfield"), alpha = 1) } \arguments{ \item{palette}{Palette type. Currently there is one available option: \code{"springfield"} (16-color palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} } \description{ Color palettes inspired by the colors used in \emph{The Simpsons}. } \examples{ library("scales") show_col(pal_simpsons("springfield")(16)) show_col(pal_simpsons("springfield", alpha = 0.6)(16)) } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/scale_nejm.Rd0000644000176200001440000000247113221611720014507 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-nejm.R \name{scale_color_nejm} \alias{scale_color_nejm} \alias{scale_colour_nejm} \alias{scale_fill_nejm} \title{NEJM Color Scales} \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{ \item{palette}{Palette type. Currently there is one available option: \code{"default"} (8-color palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} \item{...}{additional parameters for \code{\link[ggplot2]{discrete_scale}}} } \description{ See \code{\link{pal_nejm}} for details. } \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() } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/rgb_material.Rd0000644000176200001440000000320413221611720015032 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/continuous-material.R \name{rgb_material} \alias{rgb_material} \title{Material Design 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{ \item{palette}{Palette type. There are 19 available options: \itemize{ \item \code{"red"} \item \code{"pink"} \item \code{"purple"} \item \code{"deep-purple"} \item \code{"indigo"} \item \code{"blue"} \item \code{"light-blue"} \item \code{"cyan"} \item \code{"teal"} \item \code{"green"} \item \code{"light-green"} \item \code{"lime"} \item \code{"yellow"} \item \code{"amber"} \item \code{"orange"}, \item \code{"deep-orange"} \item \code{"brown"} \item \code{"grey"} \item \code{"blue-grey"}} See the \href{https://material.io/guidelines/style/color.html}{material design color guidelines} for details.} \item{n}{Number of individual colors to be generated.} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} \item{reverse}{Logical. Should the order of the colors be reversed?} } \description{ The Material Design color palettes. } \examples{ library("scales") show_col(pal_material("indigo")(10)) show_col(pal_material("indigo", n = 30, alpha = 0.6, reverse = TRUE)(30)) } \references{ \url{https://material.io/guidelines/style/color.html} } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/pal_tron.Rd0000644000176200001440000000133413221611720014222 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-tron.R \name{pal_tron} \alias{pal_tron} \title{Tron Legacy Color Palettes} \usage{ pal_tron(palette = c("legacy"), alpha = 1) } \arguments{ \item{palette}{Palette type. Currently there is one available option: \code{"legacy"} (7-color palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} } \description{ Color palettes inspired by the colors used in \emph{Tron Legacy}. } \examples{ library("scales") show_col(pal_tron("legacy")(7)) show_col(pal_tron("legacy", alpha = 0.6)(7)) } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/scale_jco.Rd0000644000176200001440000000250713221611720014331 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-jco.R \name{scale_color_jco} \alias{scale_color_jco} \alias{scale_colour_jco} \alias{scale_fill_jco} \title{Journal of Clinical Oncology Color Scales} \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{ \item{palette}{Palette type. Currently there is one available option: \code{"default"} (10-color palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} \item{...}{additional parameters for \code{\link[ggplot2]{discrete_scale}}} } \description{ See \code{\link{pal_jco}} for details. } \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() } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/pal_lancet.Rd0000644000176200001440000000144113221611720014505 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-lancet.R \name{pal_lancet} \alias{pal_lancet} \title{Lancet Journal Color Palettes} \usage{ pal_lancet(palette = c("lanonc"), alpha = 1) } \arguments{ \item{palette}{Palette type. Currently there is one available option: \code{"lanonc"} (9-color palette inspired by \emph{Lancet Oncology}).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} } \description{ Color palettes inspired by plots in Lancet journals, such as \emph{Lancet Oncology}. } \examples{ library("scales") show_col(pal_lancet("lanonc")(9)) show_col(pal_lancet("lanonc", alpha = 0.6)(9)) } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/pal_jco.Rd0000644000176200001440000000136413221611720014016 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-jco.R \name{pal_jco} \alias{pal_jco} \title{Journal of Clinical Oncology Color Palettes} \usage{ pal_jco(palette = c("default"), alpha = 1) } \arguments{ \item{palette}{Palette type. Currently there is one available option: \code{"default"} (10-color palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} } \description{ Color palette inspired by plots in \emph{Journal of Clinical Oncology}. } \examples{ library("scales") show_col(pal_jco("default")(10)) show_col(pal_jco("default", alpha = 0.6)(10)) } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/pal_nejm.Rd0000644000176200001440000000134613221611720014174 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-nejm.R \name{pal_nejm} \alias{pal_nejm} \title{NEJM Color Palettes} \usage{ pal_nejm(palette = c("default"), alpha = 1) } \arguments{ \item{palette}{Palette type. Currently there is one available option: \code{"default"} (8-color palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} } \description{ Color palette inspired by plots in \emph{The New England Journal of Medicine}. } \examples{ library("scales") show_col(pal_nejm("default")(8)) show_col(pal_nejm("default", alpha = 0.6)(8)) } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/scale_tron.Rd0000644000176200001440000000276513221611720014546 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-tron.R \name{scale_color_tron} \alias{scale_color_tron} \alias{scale_colour_tron} \alias{scale_fill_tron} \title{Tron Legacy Color Scales} \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{ \item{palette}{Palette type. Currently there is one available option: \code{"legacy"} (7-color palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} \item{...}{additional parameters for \code{\link[ggplot2]{discrete_scale}}} } \description{ See \code{\link{pal_tron}} for details. } \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() } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/scale_npg.Rd0000644000176200001440000000251713221611720014343 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-npg.R \name{scale_color_npg} \alias{scale_color_npg} \alias{scale_colour_npg} \alias{scale_fill_npg} \title{NPG Journal Color Scales} \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{ \item{palette}{Palette type. Currently there is one available option: \code{"nrc"} (10-color palette inspired by \emph{Nature Reviews Cancer}).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} \item{...}{additional parameters for \code{\link[ggplot2]{discrete_scale}}} } \description{ See \code{\link{pal_npg}} for details. } \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() } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/pal_locuszoom.Rd0000644000176200001440000000162613221611720015276 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-locuszoom.R \name{pal_locuszoom} \alias{pal_locuszoom} \title{LocusZoom Color Palette} \usage{ pal_locuszoom(palette = c("default"), alpha = 1) } \arguments{ \item{palette}{Palette type. Currently there is one available option: \code{"default"} (7-color palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} } \description{ Color palettes based on the colors used by LocusZoom. } \examples{ library("scales") show_col(pal_locuszoom("default")(7)) show_col(pal_locuszoom("default", alpha = 0.6)(7)) } \references{ Pruim, Randall J., et al. (2010). LocusZoom: regional visualization of genome-wide association scan results. \emph{Bioinformatics}, 26(18), 2336--2337. } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/scale_ucscgb.Rd0000644000176200001440000000253713221611720015027 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-ucscgb.R \name{scale_color_ucscgb} \alias{scale_color_ucscgb} \alias{scale_colour_ucscgb} \alias{scale_fill_ucscgb} \title{UCSC Genome Browser Color Scales} \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{ \item{palette}{Palette type. Currently there is one available option: \code{"default"} (26-color palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} \item{...}{additional parameters for \code{\link[ggplot2]{discrete_scale}}} } \description{ See \code{\link{pal_ucscgb}} for details. } \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() } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/pal_rickandmorty.Rd0000644000176200001440000000143513221611720015750 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-rickandmorty.R \name{pal_rickandmorty} \alias{pal_rickandmorty} \title{Rick and Morty Color Palettes} \usage{ pal_rickandmorty(palette = c("schwifty"), alpha = 1) } \arguments{ \item{palette}{Palette type. Currently there is one available option: \code{"schwifty"} (12-color palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} } \description{ Color palettes inspired by the colors used in \emph{Rick and Morty}. } \examples{ library("scales") show_col(pal_rickandmorty("schwifty")(12)) show_col(pal_rickandmorty("schwifty", alpha = 0.6)(12)) } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/scale_rickandmorty.Rd0000644000176200001440000000264013221611720016262 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-rickandmorty.R \name{scale_color_rickandmorty} \alias{scale_color_rickandmorty} \alias{scale_colour_rickandmorty} \alias{scale_fill_rickandmorty} \title{Rick and Morty Color Scales} \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{ \item{palette}{Palette type. Currently there is one available option: \code{"schwifty"} (12-color palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} \item{...}{additional parameters for \code{\link[ggplot2]{discrete_scale}}} } \description{ See \code{\link{pal_rickandmorty}} for details. } \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() } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/scale_aaas.Rd0000644000176200001440000000253513221611720014464 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-aaas.R \name{scale_color_aaas} \alias{scale_color_aaas} \alias{scale_colour_aaas} \alias{scale_fill_aaas} \title{AAAS Journal Color Scales} \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{ \item{palette}{Palette type. Currently there is one available option: \code{"default"} (10-color palette inspired by \emph{Science}).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} \item{...}{additional parameters for \code{\link[ggplot2]{discrete_scale}}} } \description{ See \code{\link{pal_aaas}} for details. } \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() } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/rgb_gsea.Rd0000644000176200001440000000226113221611720014155 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/continuous-gsea.R \name{rgb_gsea} \alias{rgb_gsea} \title{The GSEA GenePattern Color Palettes} \usage{ rgb_gsea(palette = c("default"), n = 12, alpha = 1, reverse = FALSE) } \arguments{ \item{palette}{Palette type. Currently there is one available option: \code{"default"} (continuous palette with 12 base colors).} \item{n}{Number of individual colors to be generated.} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} \item{reverse}{Logical. Should the order of the colors be reversed?} } \description{ Color palette inspired by the colors used in the heatmaps plotted by GSEA GenePattern. } \note{ The 12 base colors used in this palette are derived from \href{ftp://ftp.broad.mit.edu/pub/genepattern/modules/HeatMapImage/broad.mit.edu:cancer.software.genepattern.module.analysis/00032/6/HeatMapImage.pdf}{this document}. } \examples{ library("scales") show_col(pal_gsea("default")(12)) show_col(pal_gsea("default", n = 30, alpha = 0.6, reverse = TRUE)(30)) } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/pal_jama.Rd0000644000176200001440000000143113221611720014146 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-jama.R \name{pal_jama} \alias{pal_jama} \title{Journal of the American Medical Association Color Palettes} \usage{ pal_jama(palette = c("default"), alpha = 1) } \arguments{ \item{palette}{Palette type. Currently there is one available option: \code{"default"} (7-color palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} } \description{ Color palette inspired by plots in \emph{The Journal of the American Medical Association}. } \examples{ library("scales") show_col(pal_jama("default")(7)) show_col(pal_jama("default", alpha = 0.6)(7)) } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/scale_futurama.Rd0000644000176200001440000000260613221611720015402 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-futurama.R \name{scale_color_futurama} \alias{scale_color_futurama} \alias{scale_colour_futurama} \alias{scale_fill_futurama} \title{The Futurama Color Scales} \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{ \item{palette}{Palette type. Currently there is one available option: \code{"planetexpress"} (12-color palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} \item{...}{additional parameters for \code{\link[ggplot2]{discrete_scale}}} } \description{ See \code{\link{pal_futurama}} for details. } \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() } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/scale_gsea.Rd0000644000176200001440000000237313221611720014476 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/continuous-gsea.R \name{scale_color_gsea} \alias{scale_color_gsea} \alias{scale_colour_gsea} \alias{scale_fill_gsea} \title{The GSEA GenePattern Color Scales} \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{ \item{palette}{Palette type. Currently there is one available option: \code{"default"} (continuous palette with 12 base colors).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} \item{reverse}{Logical. Should the order of the colors be reversed?} \item{...}{additional parameters for \code{\link[ggplot2]{discrete_scale}}} } \description{ See \code{\link{pal_gsea}} for details. } \examples{ library("ggplot2") library("reshape2") data("mtcars") cor = cor(mtcars) cor_melt = melt(cor) ggplot(cor_melt, aes(x = Var1, y = Var2, fill = value)) + geom_tile(colour = "black", size = 0.3) + theme_bw() + scale_fill_gsea() } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/scale_material.Rd0000644000176200001440000000450313221611720015352 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/continuous-material.R \name{scale_color_material} \alias{scale_color_material} \alias{scale_colour_material} \alias{scale_fill_material} \title{Material Design Color Palettes} \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{ \item{palette}{Palette type. There are 19 available options: \itemize{ \item \code{"red"} \item \code{"pink"} \item \code{"purple"} \item \code{"deep-purple"} \item \code{"indigo"} \item \code{"blue"} \item \code{"light-blue"} \item \code{"cyan"} \item \code{"teal"} \item \code{"green"} \item \code{"light-green"} \item \code{"lime"} \item \code{"yellow"} \item \code{"amber"} \item \code{"orange"}, \item \code{"deep-orange"} \item \code{"brown"} \item \code{"grey"} \item \code{"blue-grey"}} See the \href{https://material.io/guidelines/style/color.html}{material design color guidelines} for details.} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} \item{reverse}{Logical. Should the order of the colors be reversed?} \item{...}{additional parameters for \code{\link[ggplot2]{discrete_scale}}} } \description{ See \code{\link{pal_material}} for details. } \examples{ library("ggplot2") library("reshape2") data("mtcars") cor = abs(cor(mtcars)) cor_melt = melt(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") } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/scale_simpsons.Rd0000644000176200001440000000257613221611720015437 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-simpsons.R \name{scale_color_simpsons} \alias{scale_color_simpsons} \alias{scale_colour_simpsons} \alias{scale_fill_simpsons} \title{The Simpsons Color Scales} \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{ \item{palette}{Palette type. Currently there is one available option: \code{"springfield"} (16-color palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} \item{...}{additional parameters for \code{\link[ggplot2]{discrete_scale}}} } \description{ See \code{\link{pal_simpsons}} for details. } \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() } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/pal_uchicago.Rd0000644000176200001440000000174313276174440015043 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-uchicago.R \name{pal_uchicago} \alias{pal_uchicago} \title{The University of Chicago Color Palettes} \usage{ pal_uchicago(palette = c("default", "light", "dark"), alpha = 1) } \arguments{ \item{palette}{Palette type. There are 3 available options: \code{"default"} (9-color palette); \code{"light"} (9-color light palette); \code{"dark"} (9-color dark palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} } \description{ Color palettes based on the colors used by the University of Chicago. } \examples{ library("scales") show_col(pal_uchicago("default")(9)) show_col(pal_uchicago("light")(9)) show_col(pal_uchicago("dark")(9)) } \references{ \url{https://news.uchicago.edu/sites/default/files/attachments/_uchicago.identity.guidelines.pdf} } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/pal_futurama.Rd0000644000176200001440000000142113221611720015061 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-futurama.R \name{pal_futurama} \alias{pal_futurama} \title{The Futurama Color Palettes} \usage{ pal_futurama(palette = c("planetexpress"), alpha = 1) } \arguments{ \item{palette}{Palette type. Currently there is one available option: \code{"planetexpress"} (12-color palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} } \description{ Color palettes inspired by the colors used in \emph{Futurama}. } \examples{ library("scales") show_col(pal_futurama("planetexpress")(12)) show_col(pal_futurama("planetexpress", alpha = 0.6)(12)) } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/scale_locuszoom.Rd0000644000176200001440000000256513221611720015614 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-locuszoom.R \name{scale_color_locuszoom} \alias{scale_color_locuszoom} \alias{scale_colour_locuszoom} \alias{scale_fill_locuszoom} \title{LocusZoom Color Scales} \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{ \item{palette}{Palette type. Currently there is one available option: \code{"default"} (7-color palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} \item{...}{additional parameters for \code{\link[ggplot2]{discrete_scale}}} } \description{ See \code{\link{pal_locuszoom}} for details. } \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() } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/pal_material.Rd0000644000176200001440000000307713221611720015044 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/continuous-material.R \name{pal_material} \alias{pal_material} \title{Material Design 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{ \item{palette}{Palette type. There are 19 available options: \itemize{ \item \code{"red"} \item \code{"pink"} \item \code{"purple"} \item \code{"deep-purple"} \item \code{"indigo"} \item \code{"blue"} \item \code{"light-blue"} \item \code{"cyan"} \item \code{"teal"} \item \code{"green"} \item \code{"light-green"} \item \code{"lime"} \item \code{"yellow"} \item \code{"amber"} \item \code{"orange"}, \item \code{"deep-orange"} \item \code{"brown"} \item \code{"grey"} \item \code{"blue-grey"}} See the \href{https://material.io/guidelines/style/color.html}{material design color guidelines} for details.} \item{n}{Number of individual colors to be generated.} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} \item{reverse}{Logical. Should the order of the colors be reversed?} } \description{ The Material Design color palettes. } \examples{ library("scales") show_col(pal_material("indigo")(10)) show_col(pal_material("indigo", n = 30, alpha = 0.6, reverse = TRUE)(30)) } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/scale_startrek.Rd0000644000176200001440000000255213221611720015415 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-startrek.R \name{scale_color_startrek} \alias{scale_color_startrek} \alias{scale_colour_startrek} \alias{scale_fill_startrek} \title{Star Trek Color Scales} \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{ \item{palette}{Palette type. Currently there is one available option: \code{"uniform"} (7-color palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} \item{...}{additional parameters for \code{\link[ggplot2]{discrete_scale}}} } \description{ See \code{\link{pal_startrek}} for details. } \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() } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/scale_uchicago.Rd0000644000176200001440000000346313276174440015357 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-uchicago.R \name{scale_color_uchicago} \alias{scale_color_uchicago} \alias{scale_colour_uchicago} \alias{scale_fill_uchicago} \title{The University of Chicago Color Scales} \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{ \item{palette}{Palette type. There are 3 available options: \code{"default"} (9-color palette); \code{"light"} (9-color light palette); \code{"dark"} (9-color dark palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} \item{...}{additional parameters for \code{\link[ggplot2]{discrete_scale}}} } \description{ See \code{\link{pal_uchicago}} for details. } \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") } \references{ \url{https://news.uchicago.edu/sites/default/files/attachments/_uchicago.identity.guidelines.pdf} } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/pal_aaas.Rd0000644000176200001440000000156513221611720014153 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-aaas.R \name{pal_aaas} \alias{pal_aaas} \title{AAAS Journal Color Palettes} \usage{ pal_aaas(palette = c("default"), alpha = 1) } \arguments{ \item{palette}{Palette type. Currently there is one available option: \code{"default"} (10-color palette inspired by \emph{Science}).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} } \description{ Color palettes inspired by plots in journals published by American Association for the Advancement of Science (AAAS), such as \emph{Science} and \emph{Science Translational Medicine}. } \examples{ library("scales") show_col(pal_aaas("default")(10)) show_col(pal_aaas("default", alpha = 0.6)(10)) } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/scale_d3.Rd0000644000176200001440000000366013221611720014065 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-d3.R \name{scale_color_d3} \alias{scale_color_d3} \alias{scale_colour_d3} \alias{scale_fill_d3} \title{D3.js Color Scales} \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{ \item{palette}{Palette type. There are 4 available options: \code{"category10"} (10-color palette); \code{"category20"} (20-color palette); \code{"category20b"} (20-color palette); \code{"category20c"} (20-color palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} \item{...}{additional parameters for \code{\link[ggplot2]{discrete_scale}}} } \description{ See \code{\link{pal_d3}} for details. } \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") } \references{ \url{https://github.com/d3/d3-3.x-api-reference/blob/master/Ordinal-Scales.md} } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/pal_startrek.Rd0000644000176200001440000000136413221611720015102 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-startrek.R \name{pal_startrek} \alias{pal_startrek} \title{Star Trek Color Palettes} \usage{ pal_startrek(palette = c("uniform"), alpha = 1) } \arguments{ \item{palette}{Palette type. Currently there is one available option: \code{"uniform"} (7-color palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} } \description{ Color palettes inspired by the colors used in \emph{Star Trek}. } \examples{ library("scales") show_col(pal_startrek("uniform")(7)) show_col(pal_startrek("uniform", alpha = 0.6)(7)) } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/pal_gsea.Rd0000644000176200001440000000171013221611720014155 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/continuous-gsea.R \name{pal_gsea} \alias{pal_gsea} \title{The GSEA GenePattern Color Palettes} \usage{ pal_gsea(palette = c("default"), n = 12, alpha = 1, reverse = FALSE) } \arguments{ \item{palette}{Palette type. Currently there is one available option: \code{"default"} (continuous palette with 12 base colors).} \item{n}{Number of individual colors to be generated.} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} \item{reverse}{Logical. Should the order of the colors be reversed?} } \description{ Color palette inspired by the colors used in the heatmaps plotted by GSEA GenePattern. } \examples{ library("scales") show_col(pal_gsea("default")(12)) show_col(pal_gsea("default", n = 30, alpha = 0.6, reverse = TRUE)(30)) } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/scale_jama.Rd0000644000176200001440000000254013221611720014463 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-jama.R \name{scale_color_jama} \alias{scale_color_jama} \alias{scale_colour_jama} \alias{scale_fill_jama} \title{Journal of the American Medical Association Color Scales} \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{ \item{palette}{Palette type. Currently there is one available option: \code{"default"} (7-color palette).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} \item{...}{additional parameters for \code{\link[ggplot2]{discrete_scale}}} } \description{ See \code{\link{pal_jama}} for details. } \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() } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/scale_lancet.Rd0000644000176200001440000000257013221611720015024 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-lancet.R \name{scale_color_lancet} \alias{scale_color_lancet} \alias{scale_colour_lancet} \alias{scale_fill_lancet} \title{Lancet Journal Color Scales} \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{ \item{palette}{Palette type. Currently there is one available option: \code{"lanonc"} (9-color palette inspired by \emph{Lancet Oncology}).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} \item{...}{additional parameters for \code{\link[ggplot2]{discrete_scale}}} } \description{ See \code{\link{pal_lancet}} for details. } \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() } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/man/pal_npg.Rd0000644000176200001440000000145513221611720014030 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/discrete-npg.R \name{pal_npg} \alias{pal_npg} \title{NPG Journal Color Palettes} \usage{ pal_npg(palette = c("nrc"), alpha = 1) } \arguments{ \item{palette}{Palette type. Currently there is one available option: \code{"nrc"} (10-color palette inspired by \emph{Nature Reviews Cancer}).} \item{alpha}{Transparency level, a real number in (0, 1]. See \code{alpha} in \code{\link[grDevices]{rgb}} for details.} } \description{ Color palettes inspired by plots in journals published by Nature Publishing Group, such as \emph{Nature Reviews Cancer}. } \examples{ library("scales") show_col(pal_npg("nrc")(10)) show_col(pal_npg("nrc", alpha = 0.6)(10)) } \author{ Nan Xiao <\email{me@nanx.me}> | <\href{https://nanx.me}{https://nanx.me}> } ggsci/LICENSE0000644000176200001440000010451313221611720012352 0ustar liggesusers GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read .