Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/shandiya/feathers

Colour palettes for data visualisation, inspired by the plumage of Australian birds
https://github.com/shandiya/feathers

colour-palette data-visualisation julia-language plot r

Last synced: 2 months ago
JSON representation

Colour palettes for data visualisation, inspired by the plumage of Australian birds

Awesome Lists containing this project

README

        

---
title: feathers
output: github_document
---

![](https://img.shields.io/badge/colours-feathers-D5114E.svg)

```{r, include=FALSE}
library(feathers)
library(dplyr)
```

This package contains colour palettes inspired by the plumage of Australian birds. For species exhibiting sexual dimorphism (i.e. males and females look different), I have used female colours. Research on birds has historically been biased towards males, and the choice to use female colours in this package is my way of highlighting the often-overlooked beauty of female birds.

## Installation

This package is hosted on GitHub and can be installed using the devtools package:

```{r, message=FALSE, warning=FALSE, echo = TRUE, results='hide'}
devtools::install_github(repo = "shandiya/feathers", ref = "main")
```

## How to use `feathers`

Colour palettes are stored as a list called `feathers_palettes`, and can be accessed thus:

```{r}
library(feathers)
names(feathers_palettes)
```

`get_pal` returns the chosen palette as a vector of hex colour codes.

```{r}
get_pal("eastern_rosella")
```

`print_pal` displays the colour palette.

```{r, fig.height=1, fig.width=7, fig.align='center'}
eastern_rosella <- get_pal("eastern_rosella")
print_pal(eastern_rosella)
```

## Examples

Colour palettes can be used for data visualisation in base `R` and `ggplot2`.

```{r message=FALSE, warning=FALSE, out.width=c('50%', '50%'), fig.show='hold'}

# base R
library(palmerpenguins)
plot(penguins$flipper_length_mm, penguins$body_mass_g, col = get_pal("rose_crowned_fruit_dove")[factor(penguins$species)], pch = 19)

# ggplot2
library(ggplot2)
library(palmerpenguins)
ggplot(penguins) +
geom_point(aes(flipper_length_mm, body_mass_g, colour = species)) +
scale_colour_manual(values = get_pal("rose_crowned_fruit_dove"))

```

## Colour palettes

The images below show each palette and the bird that inspired it.

### Eastern Rosella (*Platycercus eximius*)

```{r rosella_pal, echo = FALSE, message=FALSE, warning=FALSE, fig.height=1, fig.width=7, fig.align='center'}
er <- get_pal("eastern_rosella")
print_pal(er)
```

```{r rosella_img, echo = FALSE, message=FALSE, warning=FALSE, fig.show="hold", out.width=c('65%', '35%')}
knitr::include_graphics("images/eastern_rosella_plot.png")
knitr::include_graphics("images/eastern_rosella_img.png")
```

Image: [Duncan McCaskill](https://commons.wikimedia.org/wiki/File:Platycercus_eximius_-Canberra,_Australia-8.jpg)

### Plains-wanderer (*Pedionomus torquatus*)

```{r wanderer_pal, echo = FALSE, message=FALSE, warning=FALSE, fig.height=1, fig.width=7, fig.align='center'}
pw <- get_pal("plains_wanderer")
print_pal(pw)
```

```{r wanderer_img, echo = FALSE, message=FALSE, warning=FALSE, fig.show="hold", out.width=c('65%', '35%')}
knitr::include_graphics("images/plains_wanderer_plot.png")
knitr::include_graphics("images/plains_wanderer_img.png")
```

Image: [JJ Harrison](https://en.wikipedia.org/wiki/Plains-wanderer#/media/File:Plains-wanderer_female_8173.jpg)

### Spotted Pardalote (*Pardalotus punctatus*)

```{r spotty_pal, echo = FALSE, message=FALSE, warning=FALSE, fig.height=1, fig.width=6, fig.align='center'}
sp <- get_pal("spotted_pardalote")
print_pal(sp)
```

```{r spotty_img, echo = FALSE, message=FALSE, warning=FALSE, fig.show="hold", out.width=c('65%', '35%')}
knitr::include_graphics("images/spotted_pardalote_plot.png")
knitr::include_graphics("images/spotted_pardalote_img.png")
```

Image: [Patrick_K59](https://commons.wikimedia.org/wiki/File:Spotted_Pardalote_(Pardalotus_punctatus)_female_(23113043855).jpg)

### Rose-crowned Fruit-Dove (*Ptilinopus regina*)

```{r rcf_dove_pal, echo = FALSE, message=FALSE, warning=FALSE, fig.height=1, fig.width=8, fig.align='center'}
rcfd <- get_pal("rose_crowned_fruit_dove")
print_pal(rcfd)
```

```{r rcf_dove_img, echo = FALSE, message=FALSE, warning=FALSE, fig.show="hold", out.width=c('65%', '35%')}
knitr::include_graphics("images/rose_crowned_fruit_dove_plot.png")
knitr::include_graphics("images/rose_crowned_fruit_dove_img.png")
```

Image: [Sheba_Also](https://commons.wikimedia.org/wiki/File:Rose_crowned_Fruit_Dove_at_Australia_Zoo-1_(9098717408).jpg)

### Rainbow Bee-eater (*Merops ornatus*)

```{r bee_eater_pal, echo = FALSE, message=FALSE, warning=FALSE, fig.height=1, fig.width=7, fig.align='center'}
be <- get_pal("bee_eater")
print_pal(be)
```

```{r bee_eater_img, echo = FALSE, message=FALSE, warning=FALSE, fig.show="hold", out.width=c('65%', '35%')}
knitr::include_graphics("images/bee_eater_plot.png")
knitr::include_graphics("images/bee_eater_img.png")
```

Image: [Jim Bendon](https://commons.wikimedia.org/wiki/File:Rainbow_bee_eater_m%26f.jpg)

### Superb Fairy-wren (*Malurus cyaneus*)

```{r superb_fw_pal, echo = FALSE, message=FALSE, warning=FALSE, fig.height=1, fig.width=5, fig.align='center'}
sfw <- get_pal("superb_fairy_wren")
print_pal(sfw)
```

```{r superb_fw_img, echo = FALSE, message=FALSE, warning=FALSE, fig.show="hold", out.width=c('65%', '35%')}
knitr::include_graphics("images/superb_fairy_wren_plot.png")
knitr::include_graphics("images/superb_fairy_wren_img.png")
```

Image: [Patrick_K59](https://commons.wikimedia.org/wiki/File:Superb_Fairy-wren_(Malurus_cyaneus)_(18115879009).jpg)

### Princess Parrot (*Polytelis alexandrae*)

```{r princess_pal, echo = FALSE, message=FALSE, warning=FALSE, fig.height=1, fig.width=8, fig.align='center'}
pp <- get_pal("princess_parrot")
print_pal(pp)
```

```{r princess_img, echo = FALSE, message=FALSE, warning=FALSE, fig.show="hold", out.width=c('65%', '35%')}
knitr::include_graphics("images/princess_parrot_plot.png")
```

### Olive-backed Oriole (*Oriolus sagittatus*)

```{r oriole_pal, echo = FALSE, message=FALSE, warning=FALSE, fig.height=1, fig.width=10, fig.align='center'}
oriole <- get_pal("oriole")
print_pal(oriole)
```

```{r oriole_img, echo = FALSE, message=FALSE, warning=FALSE, fig.show="hold", out.width=c('65%', '35%')}
knitr::include_graphics("images/oriole_plot.png")
knitr::include_graphics("images/oriole_img.png")
```

Image: [Patrick_K59](https://commons.wikimedia.org/wiki/File:Olive-backed_Oriole_(Oriolus_sagittatus)_(16640844194).jpg)

### Southern Cassowary (*Casuarius casuarius*)

```{r cassowary_pal, echo = FALSE, message=FALSE, warning=FALSE, fig.height=1, fig.width=8, fig.align='center'}
cass <- get_pal("cassowary")
print_pal(cass)
```

```{r cassowary_img, echo = FALSE, message=FALSE, warning=FALSE, fig.show="hold", out.width=c('65%', '35%')}
knitr::include_graphics("images/cassowary_plot.png")
knitr::include_graphics("images/cassowary_img.png")
```

Image: [Nick Hobgood](https://commons.wikimedia.org/wiki/File:Casuarius_casuarius_Southern_Cassowary_Papua_New_Guinea_by_Nick_Hobgood.jpg)

### Eastern Yellow Robin (*Eopsaltria australis*)

```{r yellow_robin_pal, echo = FALSE, message=FALSE, warning=FALSE, fig.height=1, fig.width=8, fig.align='center'}
robin <- get_pal("yellow_robin")
print_pal(robin)
```

```{r yellow_robin_img, echo = FALSE, message=FALSE, warning=FALSE, fig.show="hold", out.width=c('65%', '35%')}
knitr::include_graphics("images/yellow_robin_plot.png")
knitr::include_graphics("images/yellow_robin_img.png")
```

Image: [Patrick_K59](https://commons.wikimedia.org/wiki/File:Eastern_Yellow_Robin_(Eopsaltria_australis)_(42280188404).jpg)

### Galah (*Eolophus roseicapilla*)

```{r galah_pal, echo = FALSE, message=FALSE, warning=FALSE, fig.height=1, fig.width=7, fig.align='center'}
gal <- get_pal("galah")
print_pal(gal)
```

```{r galah_img, echo = FALSE, message=FALSE, warning=FALSE, fig.show="hold", out.width=c('65%', '35%')}
knitr::include_graphics("images/galah_plot.png")
knitr::include_graphics("images/galah_img.png")
```

Image: [Calistemon](https://commons.wikimedia.org/wiki/File:Galah_(Eolophus_roseicapilla)_at_Coalseam_Conservation_Park,_August_2022_16.jpg)

## Continuous palettes

The qualitative colour palettes in `feathers` may be converted into sequential or diverging palettes for different types of data visualisation using the `colorRampPalette()` function.

### Sequential palette

```{r, results = FALSE}
# choose end colours
seq_col <- get_pal("eastern_rosella")[c(2,7)]

# create a gradient of 50 shades in between the selected colours
colorRampPalette(seq_col)(50)
```

```{r, echo = FALSE, fig.height=2, fig.width=10, fig.align='center'}
print_pal(colorRampPalette(seq_col)(50))
```

### Diverging palette

```{r, results = FALSE}
# choose end and middle colours
div_col <- get_pal("oriole")[c(1,5,10)]

# create a gradient of 50 shades in between the selected colours
colorRampPalette(div_col)(50)
```

```{r, echo = FALSE, fig.height=2, fig.width=10, fig.align='center'}
print_pal(colorRampPalette(div_col)(50))
```

## Accessibility

There are many tools and packages which simulate different types of colour vision deficiency, such as [Viz Palette](https://projects.susielu.com/viz-palette), [colorblindcheck](https://jakubnowosad.com/colorblindcheck/index.html), [prismatic](https://emilhvitfeldt.github.io/prismatic/), and [colorblindr](https://github.com/clauswilke/colorblindr). You may find these helpful in guiding your decisions about which colours to include in your visualisation to make it accessible to as many people as possible. Happy plotting!

## Contribute

If you would like to contribute to this package or have suggestions for improvement, please contact [ShandiyaB](https://twitter.com/ShandiyaB) on Twitter or submit a pull request.