Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://emilhvitfeldt.github.io/paletteer/
🎨🎨🎨 Collection of most color palettes in a single R package
https://emilhvitfeldt.github.io/paletteer/
color-palette palettes r rstats
Last synced: about 1 month ago
JSON representation
🎨🎨🎨 Collection of most color palettes in a single R package
- Host: GitHub
- URL: https://emilhvitfeldt.github.io/paletteer/
- Owner: EmilHvitfeldt
- License: other
- Created: 2018-06-23T07:19:00.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-06-24T15:21:27.000Z (6 months ago)
- Last Synced: 2024-11-11T14:50:51.973Z (about 1 month ago)
- Topics: color-palette, palettes, r, rstats
- Language: R
- Homepage: https://emilhvitfeldt.github.io/paletteer/
- Size: 17.3 MB
- Stars: 937
- Watchers: 17
- Forks: 46
- Open Issues: 10
-
Metadata Files:
- Readme: README.Rmd
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE.note
Awesome Lists containing this project
README
---
output: github_document
---```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
```# paletteer
[![R-CMD-check](https://github.com/emilhvitfeldt/paletteer/workflows/R-CMD-check/badge.svg)](https://github.com/emilhvitfeldt/paletteer/actions)
[![CRAN status](https://www.r-pkg.org/badges/version/paletteer)](https://cran.r-project.org/package=paletteer)
[![CRAN_Download_Badge](http://cranlogs.r-pkg.org/badges/paletteer)](https://CRAN.R-project.org/package=paletteer)
[![Codecov test coverage](https://codecov.io/gh/emilhvitfeldt/paletteer/branch/main/graph/badge.svg)](https://app.codecov.io/gh/emilhvitfeldt/paletteer?branch=main)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html)The goal of **paletteer** is to be a comprehensive collection of color palettes in R using a common interface. Think of it as the "caret of palettes".
**Notice** This version is not backwards compatible with versions <= 0.2.1. Please refer to the end of the readme for breaking changes
## Installation
You can install the released version of **paletteer** from [CRAN](https://CRAN.R-project.org) with:
``` r
install.packages("paletteer")
```If you want the development version instead then install directly from GitHub:
```{r, eval=FALSE}
# install.packages("devtools")
devtools::install_github("EmilHvitfeldt/paletteer")
```## Palettes
The palettes are divided into 2 groups; *discrete* and *continuous*. For discrete palette you have the choice between the *fixed width palettes* and *dynamic palettes*. Most common of the two are the fixed width palettes which have a set amount of colors which doesn't change when the number of colors requested vary like the following palettes:
```{r echo=FALSE}
library(paletteer)
pals::pal.bands(
paletteer_d("nord::frost"),
paletteer_d("dutchmasters::milkmaid"),
paletteer_d("LaCroixColoR::Lime"),
main = "Fixed width palettes",
labels = c("nord\n frost", "dutchmasters\n milkmaid", "LaCroixColoR\n Lime")
)
```on the other hand we have the dynamic palettes where the colors of the palette depend on the number of colors you need like the `green.pal` palette from the `cartography` package:
```{r echo=FALSE}
pals::pal.bands(
paletteer_dynamic("cartography::green.pal", 2),
paletteer_dynamic("cartography::green.pal", 5),
paletteer_dynamic("cartography::green.pal", 8),
main = "Dynamic palettes",
labels = c("cartography\n green.pal\n n = 2",
"cartography\n green.pal\n n = 5",
"cartography\n green.pal\n n = 6")
)
```Lastly we have the continuous palettes which provides as many colors as you need for a smooth transition of color:
```{r echo=FALSE}
library(paletteer)
pals::pal.bands(
paletteer_c("viridis::inferno", 256),
paletteer_c("grDevices::terrain.colors", 256),
paletteer_c("scico::berlin", 256),
main = "continuous palettes",
labels = c("viridis\n inferno", "grDevices\n terrain.colors", "scico\n berlin")
)
```This package includes `r nrow(palettes_c_names) + nrow(palettes_d_names) + nrow(palettes_dynamic_names)` palettes from `r length(unique(c(palettes_c_names$package, palettes_d_names$package, palettes_dynamic_names$package))) - 2` different packages and information about these can be found in the following data.frames: `palettes_c_names`, `palettes_d_names` and `palettes_dynamic_names`. Additionally this [github repo](https://github.com/EmilHvitfeldt/r-color-palettes) showcases all the palettes included in the package and more.
## Examples
All the palettes can be accessed from the 3 functions `paletteer_c()`, `paletteer_d()` and `paletteer_dynamic()` using the by using the syntax packagename::palettename.
```{r}
paletteer_c("scico::berlin", n = 10)
paletteer_d("nord::frost")
paletteer_dynamic("cartography::green.pal", 5)
```All of the functions now also support tab completion to easily access the hundreds of choices
![](man/figures/paletteer-demo.gif)
## ggplot2 scales
Lastly the package also includes scales for `ggplot2` using the same standard interface
```{r}
library(ggplot2)ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) +
geom_point() +
scale_color_paletteer_d("nord::aurora")
```## Palette explorer
A [web application](https://r-graph-gallery.com/color-palette-finder) is available to quickly explore the available palettes.
[![](man/figures/colorPaletteFinder.gif)](https://r-graph-gallery.com/color-palette-finder)
## Breaking changes
In version <= 0.2.1 a palatte was selected by specifying a `package` and `palette` argument like so
```{r, eval=FALSE}
paletteer_c(package = "nord", palette = "frost")
```After version 0.2.1 palettes are selected using the syntax `"packagename::palettename"` inside the palette functions.
```{r, eval=FALSE}
paletteer_c("nord::frost")
```## Special thanks
- [Hadley Wickham](https://github.com/hadley) For helpful code improvements.
## Included packages
**paletteer** includes palettes from the following packages:
```{r, echo=FALSE}
p_df <- paletteer_packages
p_df$Github <- ifelse(!is.na(paletteer_packages$Github),
paste0("[", paletteer_packages$Github, " - ",
paletteer_packages$github_ver, "](https://github.com/",
paletteer_packages$Github, ")"),
"-")p_df$CRAN <- ifelse(paletteer_packages$CRAN,
paste0("[", paletteer_packages$CRAN_ver, "](https://CRAN.R-project.org/package=", paletteer_packages$Name,
")"),
"-")
p_df$CRAN[p_df$Name == "grDevices"] <- p_df$CRAN_ver[p_df$Name == "grDevices"]knitr::kable(p_df[c("Name", "Github", "CRAN")])
```