Skip to content
This repository has been archived by the owner on Jan 30, 2025. It is now read-only.

Commit

Permalink
Update vignettes
Browse files Browse the repository at this point in the history
  • Loading branch information
nfrerebeau committed Dec 14, 2023
1 parent 4c7eb58 commit 6bb7d13
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
10 changes: 7 additions & 3 deletions vignettes/crameri.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ vignette: >
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.align = "center"
out.width = "100%"
)
```

Expand All @@ -27,15 +27,15 @@ library(khroma)
```

## Introduction
@crameri2018 offers carefully chosen schemes, ready for mapping data, with colors that are:
Crameri (2018) offers carefully chosen schemes, ready for mapping data, with colors that are:

* Perceptually uniform,
* Perceptually ordered,
* Color vision deficiency friendly,
* Readable as black and white print,
* Citable & reproducible.

All the scales presented in @crameri2021 are implemented here, for use with base R **graphics** or [**ggplot2**](https://ggplot2.tidyverse.org/).
All the scales presented in Crameri (2021) are implemented here, for use with base R **graphics**, [**ggplot2**](https://ggplot2.tidyverse.org/) or [**ggraph**](https://ggraph.data-imaginist.com/).

## Diverging data

Expand Down Expand Up @@ -224,3 +224,7 @@ plot(fes(256))
```

## References

Crameri, F. 2018. "Geodynamic Diagnostics, Scientific Visualisation and StagLab 3.0." *Geoscientific Model Development* 11 (6): 2541-2562. DOI: [10.5194/gmd-11-2541-2018](https://doi.org/10.5194/gmd-11-2541-2018).

Crameri, F. 2021. *Scientific Colour Maps* (version 7.0.0). Zenodo. DOI: [10.5281/zenodo.4491293](https://doi.org/10.5281/zenodo.4491293).
22 changes: 15 additions & 7 deletions vignettes/tol.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,26 @@ vignette: >
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(collapse = TRUE, comment = "#>")
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
out.width = "100%"
)
```

```{r packages}
library(khroma)
```

## Introduction
@tol2021 offers carefully chosen schemes, ready for each type of data, with colors that are:
Tol (2021) offers carefully chosen schemes, ready for each type of data, with colors that are:

* Distinct for all people, including color-blind readers,
* Distinct from black and white,
* Distinct on screen and paper,
* Matching well together.

All the scales presented in Paul Tol's technical note (issue 3.2, 2021-08-18) are implemented here, for use with base R **graphics** or [**ggplot2**](https://ggplot2.tidyverse.org/).
All the scales presented in Paul Tol's technical note (issue 3.2, 2021-08-18) are implemented here, for use with base R **graphics**, [**ggplot2**](https://ggplot2.tidyverse.org/) or [**ggraph**](https://ggraph.data-imaginist.com/).

## Qualitative data
According to Paul Tol's technical note, the *bright*, *contrast*, *vibrant* and *muted* color schemes are color-blind safe.
Expand Down Expand Up @@ -161,7 +165,7 @@ plot_scheme(incandescent(11), colours = TRUE, size = 0.5)
```

### *rainbow*
As a general rule, ordered data should not be represented using a rainbow scheme. There are three main arguments against such use [@tol2021]:
As a general rule, ordered data should not be represented using a rainbow scheme. There are three main arguments against such use (Tol 2021):

* The spectral order of visible light carries no inherent magnitude message.
* Some bands of almost constant hue with sharp transitions between them, can be perceived as jumps in the data.
Expand All @@ -173,7 +177,7 @@ If such use cannot be avoided, Paul Tol's technical note provides two color sche
: This scheme must not be interpolated.

*smooth rainbow*
: This scheme does not have to be used over the full range [@tol2021 suggests starting at purple].
: This scheme does not have to be used over the full range. Tol (2021) suggests starting at purple.

```{r tol_seq_rainbow, fig.height=2, fig.width=7}
discrete_rainbow <- color("discrete rainbow")
Expand Down Expand Up @@ -210,12 +214,14 @@ plot_map(light(9))
```{r tol_div, echo=FALSE, fig.height = 2, fig.width = 7, fig.show='hold', fig.cap='Diagnostic maps for the sunset, BuRd and PRGn (from top to bottom) diverging color schemes.'}
set.seed(12345)
plot_map(sunset(11))
plot_map(nightfall(17))
plot_map(BuRd(9))
plot_map(PRGn(9))
```

```{r tol_div_map, echo=FALSE, fig.height = 7, fig.width = 7, out.width='30%', fig.show='hold', fig.cap='Diagnostic maps for the sunset, BuRd and PRGn diverging color schemes.'}
```{r tol_div_map, echo=FALSE, fig.height = 7, fig.width = 7, out.width='50%', fig.show='hold', fig.cap='Diagnostic maps for the sunset, BuRd and PRGn diverging color schemes.'}
plot_tiles(color("sunset")(128), n = 256)
plot_tiles(color("nightfall")(128), n = 256)
plot_tiles(color("BuRd")(128), n = 256)
plot_tiles(color("PRGn")(128), n = 256)
```
Expand All @@ -231,11 +237,13 @@ plot_map(discrete_rainbow(14))
plot_map(smooth_rainbow(23))
```

```{r tol_seq_map, echo=FALSE, fig.height = 7, fig.width = 7, out.width='30%', fig.show='hold', fig.cap='Diagnostic maps for the YlOrBr, iridescent and smooth rainbow sequential color schemes.'}
```{r tol_seq_map, echo=FALSE, fig.height = 7, fig.width = 7, out.width='50%', fig.show='hold', fig.cap='Diagnostic maps for the YlOrBr, iridescent and smooth rainbow sequential color schemes.'}
plot_tiles(color("YlOrBr")(128), n = 256)
plot_tiles(color("iridescent")(128), n = 256)
plot_tiles(color("incandescent")(128), n = 256)
plot_tiles(color("smooth rainbow")(128), n = 256)
```

## References

Tol, P. 2021. "Colour Schemes." Technical note SRON/EPS/TN/09-002 3.2. SRON. URL: <https://personal.sron.nl/~pault/data/colourschemes.pdf>.

0 comments on commit 6bb7d13

Please sign in to comment.