r-jcolors
A set of color palettes I like (or can at least tolerate)
Science Score: 10.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
2 of 3 committers (66.7%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (8.7%) to scientific vocabulary
Keywords
color-palettes
data-visualization
ggplot2
r-package
visualization
Last synced: 6 months ago
·
JSON representation
Repository
A set of color palettes I like (or can at least tolerate)
Basic Info
- Host: GitHub
- Owner: jaredhuling
- Language: HTML
- Default Branch: master
- Homepage: https://jaredhuling.github.io/jcolors
- Size: 43.1 MB
Statistics
- Stars: 25
- Watchers: 1
- Forks: 5
- Open Issues: 0
- Releases: 4
Topics
color-palettes
data-visualization
ggplot2
r-package
visualization
Created almost 9 years ago
· Last pushed almost 2 years ago
Metadata Files
Readme
README.Rmd
---
output: github_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, fig.path = "vignettes/readme_figs/")
```
# `jcolors` intro
[](https://cran.r-project.org/package=jcolors)
`jcolors` contains a selection of `ggplot2` color palettes that I like (or can at least tolerate to some degree)
## Installation
Install `jcolors` from GitHub:
```{r, eval = FALSE}
install.packages("devtools")
devtools::install_github("jaredhuling/jcolors")
```
Access the `jcolors` color palettes with `jcolors()`:
```{r eval = TRUE, message = FALSE, warning = FALSE}
library(jcolors)
jcolors('default')
```
## Display all available palettes
### Discrete palettes
```{r displayall, fig.height = 8}
display_all_jcolors()
```
### Continuous palettes
```{r contin_example_display, fig.height = 8}
display_all_jcolors_contin()
```
# Discrete Color Palettes
## Use with `ggplot2`
Now use `scale_color_jcolors()` with `ggplot2`:
```{r eval = TRUE, message = FALSE, warning = FALSE}
library(ggplot2)
library(gridExtra)
data(morley)
pltl <- ggplot(data = morley, aes(x = Run, y = Speed,
group = factor(Expt),
colour = factor(Expt))) +
geom_line(size = 2) +
theme_bw() +
theme(panel.background = element_rect(fill = "grey97"),
panel.border = element_blank(),
legend.position = "bottom")
pltd <- ggplot(data = morley, aes(x = Run, y = Speed,
group = factor(Expt),
colour = factor(Expt))) +
geom_line(size = 2) +
theme_bw() +
theme(panel.background = element_rect(fill = "grey15"),
legend.key = element_rect(fill = "grey15"),
panel.border = element_blank(),
panel.grid.major = element_line(color = "grey45"),
panel.grid.minor = element_line(color = "grey25"),
legend.position = "bottom")
grid.arrange(pltl + scale_color_jcolors(palette = "default"),
pltd + scale_color_jcolors(palette = "default"), ncol = 2)
grid.arrange(pltl + scale_color_jcolors(palette = "pal2"),
pltd + scale_color_jcolors(palette = "pal2"), ncol = 2)
```
Color palettes can be displayed using `display_jcolors()`
## default
```{r}
display_jcolors("default")
```
## pal2
```{r}
display_jcolors("pal2")
```
## pal3
```{r}
display_jcolors("pal3")
```
## pal4
```{r}
display_jcolors("pal4")
```
## pal5
```{r}
display_jcolors("pal5")
```
## pal6
```{r}
display_jcolors("pal6")
```
## pal7
```{r}
display_jcolors("pal7")
```
## pal8
```{r}
display_jcolors("pal8")
```
## pal9
```{r}
display_jcolors("pal9")
```
## pal10
```{r}
display_jcolors("pal10")
```
## pal11
```{r}
display_jcolors("pal11")
```
## pal12
```{r}
display_jcolors("pal12")
```
## rainbow
```{r}
display_jcolors("rainbow")
```
## More example plots
```{r moreplots}
grid.arrange(pltl + scale_color_jcolors(palette = "pal3"),
pltd + scale_color_jcolors(palette = "pal3"), ncol = 2)
grid.arrange(pltl + scale_color_jcolors(palette = "pal4"),
pltd + scale_color_jcolors(palette = "pal4") +
theme(panel.background = element_rect(fill = "grey5")), ncol = 2)
grid.arrange(pltl + scale_color_jcolors(palette = "pal5"),
pltd + scale_color_jcolors(palette = "pal5"), ncol = 2)
pltd <- ggplot(data = OrchardSprays, aes(x = rowpos, y = decrease,
group = factor(treatment),
colour = factor(treatment))) +
geom_line(size = 2) +
geom_point(size = 4) +
theme_bw() +
theme(panel.background = element_rect(fill = "grey15"),
legend.key = element_rect(fill = "grey15"),
panel.border = element_blank(),
panel.grid.major = element_line(color = "grey45"),
panel.grid.minor = element_line(color = "grey25"),
legend.position = "bottom")
pltd + scale_color_jcolors(palette = "pal6")
```
# Continuous Color Palettes
## Display all continuous palettes
```{r contin_example, fig.height = 8}
display_all_jcolors_contin()
```
## Use with `ggplot2`
```{r mountain_ex, fig.height=6}
set.seed(42)
plt <- ggplot(data.frame(x = rnorm(10000), y = rexp(10000, 1.5)), aes(x = x, y = y)) +
geom_hex() + coord_fixed() + theme(legend.position = "bottom")
plt2 <- plt + scale_fill_jcolors_contin("pal2", bias = 1.75) + theme_bw()
plt3 <- plt + scale_fill_jcolors_contin("pal3", reverse = TRUE, bias = 2.25) + theme_bw()
plt4 <- plt + scale_fill_jcolors_contin("pal12", reverse = TRUE, bias = 2) + theme_bw()
grid.arrange(plt2, plt3, plt4, ncol = 2)
```
# `ggplot2` themes
```{r diamonds_light_theme, fig.height = 6, message = FALSE, warning = FALSE}
library(scales)
p1 <- ggplot(aes(x = carat, y = price), data = diamonds) +
geom_point(alpha = 0.5, size = 1, aes(color = clarity)) +
scale_x_continuous(trans = log10_trans(), limits = c(0.2, 3),
breaks = c(0.2, 0.5, 1, 2, 3)) +
scale_y_continuous(trans = log10_trans(), limits = c(350, 15000),
breaks = c(350, 1000, 5000, 10000, 15000)) +
ggtitle('Price (log10) by Carat (log10) and Clarity') +
scale_color_jcolors("rainbow") +
theme_light_bg()
p2 <- ggplot(aes(x = carat, y = price), data = diamonds) +
geom_point(alpha = 0.5, size = 1, aes(color = cut)) +
scale_x_continuous(trans = log10_trans(), limits = c(0.2, 3),
breaks = c(0.2, 0.5, 1, 2, 3)) +
scale_y_continuous(trans = log10_trans(), limits = c(350, 15000),
breaks = c(350, 1000, 5000, 10000, 15000)) +
ggtitle('Price (log10) by Carat (log10) and Cut') +
scale_color_jcolors("pal4") +
theme_light_bg()
grid.arrange(p1, p2, ncol = 2)
```
```{r jitterplot, fig.height = 6, message = FALSE, warning = FALSE}
p1 <- ggplot(aes(x = clarity, y = price), data = diamonds) +
geom_point(alpha = 0.25, size = 1, position = "jitter", aes(color = log(carat + 1))) +
scale_y_continuous(trans = log10_trans(), limits = c(350, 15000),
breaks = c(350, 1000, 5000, 10000, 15000)) +
ggtitle('Price (log10) by Carat (log10) and Clarity')
p2 <- ggplot(aes(x = clarity, y = price), data = diamonds) +
geom_point(alpha = 0.25, size = 1, position = "jitter", aes(color = log(carat + 1))) +
scale_y_continuous(trans = log10_trans(), limits = c(350, 15000),
breaks = c(350, 1000, 5000, 10000, 15000)) +
ggtitle('Price (log10) by Carat (log10) and Clarity')
grid.arrange(p1 + scale_color_jcolors_contin("pal3", bias = 1.75) + theme_light_bg(),
p2 + scale_color_jcolors_contin("rainbow") + theme_light_bg(), ncol = 2)
```
If the background here were dark, then this would look nice:
```{r darkbg, warning = FALSE}
grid.arrange(p1 + scale_color_jcolors_contin("pal3", bias = 1.75) + theme_dark_bg(),
p2 + scale_color_jcolors_contin("rainbow") + theme_dark_bg(), ncol = 2)
```
Owner
- Name: Jared Huling
- Login: jaredhuling
- Kind: user
- Website: http://jaredhuling.org
- Repositories: 41
- Profile: https://github.com/jaredhuling
Assistant Professor in the Division of Biostatistics at the University of Minnesota
GitHub Events
Total
Last Year
Committers
Last synced: over 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| jaredhuling | h****g@w****u | 50 |
| jaredhuling | h****7@o****u | 19 |
| jaredhuling | j****g@g****m | 2 |
Issues and Pull Requests
Last synced: 8 months ago
All Time
- Total issues: 3
- Total pull requests: 0
- Average time to close issues: 4 months
- Average time to close pull requests: N/A
- Total issue authors: 3
- Total pull request authors: 0
- Average comments per issue: 1.33
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- JMMaronge (1)
- paleolimbot (1)
- akhst7 (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 2
- Total downloads: unknown
-
Total dependent packages: 1
(may contain duplicates) -
Total dependent repositories: 0
(may contain duplicates) - Total versions: 6
proxy.golang.org: github.com/jaredhuling/jcolors
- Documentation: https://pkg.go.dev/github.com/jaredhuling/jcolors#section-documentation
-
Latest release: v0.0.4
published almost 7 years ago
Rankings
Dependent packages count: 5.4%
Average: 5.5%
Dependent repos count: 5.7%
Last synced:
6 months ago
conda-forge.org: r-jcolors
- Homepage: https://jaredhuling.github.io/jcolors/
- License: GPL-2
-
Latest release: 0.0.4
published almost 7 years ago
Rankings
Dependent packages count: 28.8%
Dependent repos count: 34.0%
Average: 38.1%
Stargazers count: 43.7%
Forks count: 46.0%
Last synced:
6 months ago
Dependencies
DESCRIPTION
cran
- R >= 3.2.0 depends
- ggplot2 >= 3.0.0 imports
- grDevices * imports
- scales * imports
- gridExtra * suggests
- knitr * suggests
- rmarkdown * suggests