ggsci
🦄 Scientific journal and sci-fi themed color palettes for ggplot2
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
â—‹CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
â—‹.zenodo.json file
-
â—‹DOI references
-
â—‹Academic publication links
-
â—‹Committers with academic emails
-
â—‹Institutional organization owner
-
â—‹JOSS paper metadata
-
â—‹Scientific vocabulary similarity
Low similarity (13.7%) to scientific vocabulary
Keywords
color-palettes
data-visualization
ggplot2
ggsci
sci-fi
scientific-journals
visualization
Last synced: 6 months ago
·
JSON representation
Repository
🦄 Scientific journal and sci-fi themed color palettes for ggplot2
Basic Info
- Host: GitHub
- Owner: nanxstats
- License: gpl-3.0
- Language: R
- Default Branch: master
- Homepage: https://nanx.me/ggsci/
- Size: 170 MB
Statistics
- Stars: 690
- Watchers: 18
- Forks: 71
- Open Issues: 3
- Releases: 11
Topics
color-palettes
data-visualization
ggplot2
ggsci
sci-fi
scientific-journals
visualization
Created almost 10 years ago
· Last pushed 6 months ago
Metadata Files
Readme
Changelog
Contributing
License
Code of conduct
README.Rmd
---
output: github_document
---
```{r, include=FALSE}
knitr::knit_hooks$set(pngquant = knitr::hook_pngquant)
knitr::opts_chunk$set(
echo = FALSE,
message = FALSE,
fig.path = "man/figures/README-",
collapse = TRUE,
comment = "#>",
dev = "ragg_png",
dpi = 72,
fig.retina = 2,
fig.width = 10.6667,
fig.height = 3.3334,
fig.align = "center",
out.width = "100%",
pngquant = "--speed=1 --quality=50"
)
```
# ggsci
[](https://github.com/nanxstats/ggsci/actions/workflows/R-CMD-check.yaml)
[](https://cran.r-project.org/package=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
You can install ggsci from CRAN:
```r
install.packages("ggsci")
```
Or try the development version on GitHub:
```r
remotes::install_github("nanxstats/ggsci")
```
[Browse the vignette](https://nanx.me/ggsci/articles/ggsci.html) (or open with
`vignette("ggsci")` in R) for a quick-start guide.
## Gallery
```{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, linewidth = 1, span = 1) +
theme_bw() +
theme(
axis.title.x = element_blank(),
axis.title.y = element_blank()
)
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() +
theme(
axis.title.x = element_blank(),
axis.title.y = element_blank()
)
```
### NPG
```{r, ggsci-npg}
p1_npg <- p1 + scale_color_npg()
p2_npg <- p2 + scale_fill_npg()
grid.arrange(p1_npg, p2_npg, ncol = 2)
```
### AAAS
```{r, ggsci-aaas}
p1_aaas <- p1 + scale_color_aaas()
p2_aaas <- p2 + scale_fill_aaas()
grid.arrange(p1_aaas, p2_aaas, ncol = 2)
```
### NEJM
```{r, ggsci-nejm}
p1_nejm <- p1 + scale_color_nejm()
p2_nejm <- p2 + scale_fill_nejm()
grid.arrange(p1_nejm, p2_nejm, ncol = 2)
```
### Lancet
```{r, ggsci-lancet}
p1_lancet <- p1 + scale_color_lancet()
p2_lancet <- p2 + scale_fill_lancet()
grid.arrange(p1_lancet, p2_lancet, ncol = 2)
```
### JAMA
```{r, ggsci-jama}
p1_jama <- p1 + scale_color_jama()
p2_jama <- p2 + scale_fill_jama()
grid.arrange(p1_jama, p2_jama, ncol = 2)
```
### BMJ
```{r, ggsci-bmj}
p1_bmj <- p1 + scale_color_bmj()
p2_bmj <- p2 + scale_fill_bmj()
grid.arrange(p1_bmj, p2_bmj, ncol = 2)
```
### JCO
```{r, ggsci-jco}
p1_jco <- p1 + scale_color_jco()
p2_jco <- p2 + scale_fill_jco()
grid.arrange(p1_jco, p2_jco, ncol = 2)
```
### UCSCGB
```{r, ggsci-ucscgb}
p1_ucscgb <- p1 + scale_color_ucscgb()
p2_ucscgb <- p2 + scale_fill_ucscgb()
grid.arrange(p1_ucscgb, p2_ucscgb, ncol = 2)
```
### D3
```{r, ggsci-d3}
p1_d3 <- p1 + scale_color_d3()
p2_d3 <- p2 + scale_fill_d3()
grid.arrange(p1_d3, p2_d3, ncol = 2)
```
### Observable
```{r, ggsci-observable}
p1_observable <- p1 + scale_color_observable()
p2_observable <- p2 + scale_fill_observable()
grid.arrange(p1_observable, p2_observable, ncol = 2)
```
### LocusZoom
```{r, ggsci-locuszoom}
p1_locuszoom <- p1 + scale_color_locuszoom()
p2_locuszoom <- p2 + scale_fill_locuszoom()
grid.arrange(p1_locuszoom, p2_locuszoom, ncol = 2)
```
### IGV
```{r, ggsci-igv}
p1_igv <- p1 + scale_color_igv()
p2_igv <- p2 + scale_fill_igv()
grid.arrange(p1_igv, p2_igv, ncol = 2)
```
### COSMIC
```{r, ggsci-cosmic}
p1_cosmic_hallmarks_light <- p1 + scale_color_cosmic("hallmarks_light")
p2_cosmic_hallmarks_light <- p2 + scale_fill_cosmic("hallmarks_light")
grid.arrange(p1_cosmic_hallmarks_light, p2_cosmic_hallmarks_light, ncol = 2)
p1_cosmic_hallmarks_dark <- p1 + scale_color_cosmic("hallmarks_dark")
p2_cosmic_hallmarks_dark <- p2 + scale_fill_cosmic("hallmarks_dark")
grid.arrange(p1_cosmic_hallmarks_dark, p2_cosmic_hallmarks_dark, ncol = 2)
p1_cosmic_signature <- p1 + scale_color_cosmic("signature_substitutions")
p2_cosmic_signature <- p2 + scale_fill_cosmic("signature_substitutions")
grid.arrange(p1_cosmic_signature, p2_cosmic_signature, ncol = 2)
```
### UChicago
```{r, ggsci-uchicago}
p1_uchicago <- p1 + scale_color_uchicago()
p2_uchicago <- p2 + scale_fill_uchicago()
grid.arrange(p1_uchicago, p2_uchicago, ncol = 2)
```
### Star Trek
```{r, ggsci-startrek}
p1_startrek <- p1 + scale_color_startrek()
p2_startrek <- p2 + scale_fill_startrek()
grid.arrange(p1_startrek, p2_startrek, ncol = 2)
```
### Tron Legacy
```{r, ggsci-tron}
p1_tron <- p1 +
theme_dark() +
theme(
panel.background = element_rect(fill = "#2D2D2D"),
legend.key = element_rect(fill = "#2D2D2D"),
axis.title.x = element_blank(), axis.title.y = element_blank()
) +
scale_color_tron()
p2_tron <- p2 +
theme_dark() +
theme(
panel.background = element_rect(fill = "#2D2D2D"),
axis.title.x = element_blank(), axis.title.y = element_blank()
) +
scale_fill_tron()
grid.arrange(p1_tron, p2_tron, ncol = 2)
```
### Futurama
```{r, ggsci-futurama}
p1_futurama <- p1 + scale_color_futurama()
p2_futurama <- p2 + scale_fill_futurama()
grid.arrange(p1_futurama, p2_futurama, ncol = 2)
```
### Rick and Morty
```{r, ggsci-rickandmorty}
p1_rickandmorty <- p1 + scale_color_rickandmorty()
p2_rickandmorty <- p2 + scale_fill_rickandmorty()
grid.arrange(p1_rickandmorty, p2_rickandmorty, ncol = 2)
```
### The Simpsons
```{r, ggsci-simpsons}
p1_simpsons <- p1 + scale_color_simpsons()
p2_simpsons <- p2 + scale_fill_simpsons()
grid.arrange(p1_simpsons, p2_simpsons, ncol = 2)
```
### Flat UI
```{r, ggsci-flatui}
p1_flatui <- p1 + scale_color_flatui()
p2_flatui <- p2 + scale_fill_flatui()
grid.arrange(p1_flatui, p2_flatui, ncol = 2)
```
### Frontiers
```{r, ggsci-frontiers}
p1_frontiers <- p1 + scale_color_frontiers()
p2_frontiers <- p2 + scale_fill_frontiers()
grid.arrange(p1_frontiers, p2_frontiers, ncol = 2)
```
### GSEA
```{r}
data("mtcars")
cor <- cor(unname(mtcars))
cor_melt <- data.frame(
Var1 = rep(seq_len(nrow(cor)), times = ncol(cor)),
Var2 = rep(seq_len(ncol(cor)), each = nrow(cor)),
value = as.vector(cor)
)
p3 <- ggplot(cor_melt, aes(x = Var1, y = Var2, fill = value)) +
geom_tile(colour = "black", linewidth = 0.3) +
theme_void() +
theme(axis.title.x = element_blank(), axis.title.y = element_blank())
```
```{r, ggsci-gsea, fig.height=4}
p3_gsea <- p3 + scale_fill_gsea()
p3_gsea_inv <- p3 + scale_fill_gsea(reverse = TRUE)
grid.arrange(p3_gsea, p3_gsea_inv, ncol = 2)
```
### Bootstrap 5
```{r}
set.seed(42)
k <- 6
x <- diag(k)
x[upper.tri(x)] <- runif(sum(1:(k - 1)), 0, 1)
x_melt <- data.frame(
Var1 = rep(seq_len(nrow(x)), times = ncol(x)),
Var2 = rep(seq_len(ncol(x)), each = nrow(x)),
value = as.vector(x)
)
p4 <- ggplot(x_melt, aes(x = Var1, y = Var2, fill = value)) +
geom_tile(colour = "black", linewidth = 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()
)
```
```{r, ggsci-bs5, fig.height=2.6}
grid.arrange(
p4 + scale_fill_bs5("blue"), p4 + scale_fill_bs5("indigo"),
p4 + scale_fill_bs5("purple"), p4 + scale_fill_bs5("pink"),
p4 + scale_fill_bs5("red"), p4 + scale_fill_bs5("orange"),
p4 + scale_fill_bs5("yellow"), p4 + scale_fill_bs5("green"),
p4 + scale_fill_bs5("teal"), p4 + scale_fill_bs5("cyan"),
p4 + scale_fill_bs5("gray"),
ncol = 8
)
```
### Material Design
```{r, ggsci-material, fig.height=3.8}
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 = 8
)
```
### Tailwind CSS
```{r, ggsci-tw3, fig.height=3.8}
grid.arrange(
p4 + scale_fill_tw3("slate"), p4 + scale_fill_tw3("gray"),
p4 + scale_fill_tw3("zinc"), p4 + scale_fill_tw3("neutral"),
p4 + scale_fill_tw3("stone"), p4 + scale_fill_tw3("red"),
p4 + scale_fill_tw3("orange"), p4 + scale_fill_tw3("amber"),
p4 + scale_fill_tw3("yellow"), p4 + scale_fill_tw3("lime"),
p4 + scale_fill_tw3("green"), p4 + scale_fill_tw3("emerald"),
p4 + scale_fill_tw3("teal"), p4 + scale_fill_tw3("cyan"),
p4 + scale_fill_tw3("sky"), p4 + scale_fill_tw3("blue"),
p4 + scale_fill_tw3("indigo"), p4 + scale_fill_tw3("violet"),
p4 + scale_fill_tw3("purple"), p4 + scale_fill_tw3("fuchsia"),
p4 + scale_fill_tw3("pink"), p4 + scale_fill_tw3("rose"),
ncol = 8
)
```
## Contribute
To contribute to this project, please take a look at the
[Contributing Guidelines](https://nanx.me/ggsci/CONTRIBUTING.html) first.
Please note that the ggsci project is released with a
[Contributor Code of Conduct](https://nanx.me/ggsci/CODE_OF_CONDUCT.html).
By contributing to this project, you agree to abide by its terms.
Owner
- Name: Nan Xiao
- Login: nanxstats
- Kind: user
- Location: Upper Gwynedd, PA
- Company: Merck & Co.
- Website: https://nanx.me
- Twitter: nanxstats
- Repositories: 144
- Profile: https://github.com/nanxstats
Statistician
GitHub Events
Total
- Issues event: 2
- Watch event: 30
- Delete event: 2
- Push event: 3
- Pull request event: 4
- Fork event: 2
- Create event: 3
Last Year
- Issues event: 2
- Watch event: 30
- Delete event: 2
- Push event: 3
- Pull request event: 4
- Fork event: 2
- Create event: 3
Committers
Last synced: 8 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Nan Xiao | r****t@g****m | 217 |
| Josh Cook | j****3@g****m | 9 |
| Clara Jegousse | c****e@g****m | 5 |
| Hui Chen | 8****9 | 3 |
| Dan Chaltiel | d****l@g****m | 1 |
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 34
- Total pull requests: 36
- Average time to close issues: 4 months
- Average time to close pull requests: 25 days
- Total issue authors: 10
- Total pull request authors: 6
- Average comments per issue: 1.06
- Average comments per pull request: 0.22
- Merged pull requests: 33
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 2
- Pull requests: 2
- Average time to close issues: N/A
- Average time to close pull requests: 25 minutes
- Issue authors: 1
- Pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 0.0
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- nanxstats (24)
- DanChaltiel (2)
- jhrcook (1)
- MMriran (1)
- lrose1 (1)
- huichen99 (1)
- Tyelcie (1)
- RuilanXu (1)
- Wellington9023 (1)
- saisaitian (1)
Pull Request Authors
- nanxstats (26)
- huichen99 (4)
- jhrcook (3)
- clarajegousse (1)
- khturner (1)
- DanChaltiel (1)
Top Labels
Issue Labels
cran (6)
enhancement (3)
documentation (2)
bug (1)
question (1)
Pull Request Labels
documentation (2)
Packages
- Total packages: 1
-
Total downloads:
- cran 124,713 last-month
- Total docker downloads: 180,244
- Total dependent packages: 30
- Total dependent repositories: 106
- Total versions: 13
- Total maintainers: 1
cran.r-project.org: ggsci
Scientific Journal and Sci-Fi Themed Color Palettes for 'ggplot2'
- Homepage: https://nanx.me/ggsci/
- Documentation: http://cran.r-project.org/web/packages/ggsci/ggsci.pdf
- License: GPL (≥ 3)
-
Latest release: 3.2.0
published over 1 year ago
Rankings
Stargazers count: 0.6%
Forks count: 1.0%
Downloads: 1.1%
Dependent repos count: 2.1%
Dependent packages count: 2.7%
Average: 4.1%
Docker downloads count: 17.3%
Maintainers (1)
Last synced:
6 months ago
Dependencies
DESCRIPTION
cran
- R >= 3.0.2 depends
- ggplot2 >= 2.0.0 imports
- grDevices * imports
- scales * imports
- gridExtra * suggests
- knitr * suggests
- reshape2 * suggests
- rmarkdown * suggests
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/check-r-package v1 composite
- r-lib/actions/setup-pandoc v1 composite
- r-lib/actions/setup-r v1 composite
- r-lib/actions/setup-r-dependencies v1 composite