Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/thomasp85/scico

Palettes for R based on the Scientific Colour-Maps
https://github.com/thomasp85/scico

color-palette rstats visualization

Last synced: 4 days ago
JSON representation

Palettes for R based on the Scientific Colour-Maps

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
```

# scico

[![R-CMD-check](https://github.com/thomasp85/scico/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/thomasp85/scico/actions/workflows/R-CMD-check.yaml)
[![CRAN_Release_Badge](http://www.r-pkg.org/badges/version-ago/scico)](https://CRAN.R-project.org/package=scico)
[![Codecov test coverage](https://codecov.io/gh/thomasp85/scico/branch/main/graph/badge.svg)](https://app.codecov.io/gh/thomasp85/scico?branch=main)

This is a small package to provide access to the colour palettes developed by
Fabio Crameri and published at . It
uses more or less the same api as
[`viridis`](https://github.com/sjmgarnier/viridis) and provides scales for
[`ggplot2`](https://github.com/tidyverse/ggplot2) without requiring `ggplot2` to
be installed.

## Installation
`scico` can be installed from CRAN with `install.packages('scico')`. If you want
the development version then install directly from GitHub:

```{r, eval=FALSE}
# install.packages("devtools")
devtools::install_github("thomasp85/scico")
```

## Palettes
`scico` provides 39 different palettes, all of which are perceptually uniform
and colourblind safe. An overview can be had with the `scico_palette_show()`
function:

```{r}
library(scico)

scico_palette_show()
```

Once you've decided on a palette you can generate colour values using the
`scico()` function:

```{r}
scico(30, palette = 'lapaz')
```

## ggplot2 support
`scico` provides relevant scales for use with `ggplot2`. It only suggests
`ggplot2` in order to stay lightweight, but if `ggplot2` is available you'll
have access to the `scale_[colour|fill]_scico()` functions:

```{r, message=FALSE}
library(ggplot2)
volcano <- data.frame(
x = rep(seq_len(ncol(volcano)), each = nrow(volcano)),
y = rep(seq_len(nrow(volcano)), ncol(volcano)),
height = as.vector(volcano)
)
ggplot(volcano, aes(x = x, y = y, fill = height)) +
geom_raster() +
scale_fill_scico(palette = 'davos')
```

## References
- Crameri, Fabio. (2018, May 8). *Scientific colour maps (Version 3.0.1)*. Zenodo. doi: 10.5281/zenodo.1243909
- Crameri, Fabio. (2018). *Geodynamic diagnostics, scientific visualisation and StagLab 3.0*. Geosci. Model Dev. Discuss. doi: 10.5194/gmd-2017-328