Skip to content

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

License

Notifications You must be signed in to change notification settings

agchesebro/feathers

 
 

Repository files navigation

feathers

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:

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:

library(feathers)
names(feathers_palettes)
##  [1] "spotted_pardalote"       "plains_wanderer"        
##  [3] "bee_eater"               "rose_crowned_fruit_dove"
##  [5] "eastern_rosella"         "oriole"                 
##  [7] "princess_parrot"         "superb_fairy_wren"      
##  [9] "cassowary"               "yellow_robin"           
## [11] "galah"

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

get_pal("eastern_rosella")
## [1] "#cd3122" "#f4c623" "#bee183" "#6c905e" "#2f533c" "#b8c9dc" "#2f7ab9"

print_pal displays the colour palette.

eastern_rosella <- get_pal("eastern_rosella")
print_pal(eastern_rosella)

Examples

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

# 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)

Image: Duncan McCaskill

Plains-wanderer (Pedionomus torquatus)

Image: JJ Harrison

Spotted Pardalote (Pardalotus punctatus)

Image: Patrick_K59

Rose-crowned Fruit-Dove (Ptilinopus regina)

Image: Sheba_Also

Rainbow Bee-eater (Merops ornatus)

Image: Jim Bendon

Superb Fairy-wren (Malurus cyaneus)

Image: Patrick_K59

Princess Parrot (Polytelis alexandrae)

Olive-backed Oriole (Oriolus sagittatus)

Image: Patrick_K59

Southern Cassowary (Casuarius casuarius)

Image: Nick Hobgood

Eastern Yellow Robin (Eopsaltria australis)

Image: Patrick_K59

Galah (Eolophus roseicapilla)

Image: Calistemon

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

# 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)

Diverging palette

# 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)

Accessibility

There are many tools and packages which simulate different types of colour vision deficiency, such as Viz Palette, colorblindcheck, prismatic, and 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!

Julia Port

There is also a proposal to add these to Julia as one of the default available color schemes (see JuliaGraphics/ColorSchemes.jl#126). To do so, simply type

using ColorSchemes
colorscheme[:cassowary] # or your preferred fowl

and use as you would another built-in Julia color scheme.

Contribute

If you would like to contribute to this package or have suggestions for improvement, please contact ShandiyaB on Twitter or submit a pull request.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • R 100.0%