New Zealand is home to a great number of native bird species, a majority being endemic to the islands. Many of these species are notable for their bright and beautiful plumage.

Using photos of birds native to New Zealand, this R package contains a selection of colour palettes constructed by extracting distinct colours chracteristic of these birds.

This package was the idea of Dr Tara McAllister (@taramcallister4) and is implemented like the
wesanderson colour paltette package, created by Karthik Ram (@_inundata).

Photo:“Kererū” contributed by Tony Stoddard of KererūDiscovery (@KereruDiscovery)

Installation


This package is hosted on Github and can install it using the devtools (>= v2.3.2) package:

# install.packages("devtools")
devtools::install_github("G-Thomson/Manu")

(Note: If this doesn’t work, update devtools as Github recently changed the term it uses for the primary version of a source code repository)

Usage


The colour palettes are stored as a list named manu_palettes. Thus you can see a list of the avaliable palettes like so:

library(Manu)
names(manu_palettes)
 [1] "Hihi"         "Hoiho"        "Kaka"         "Kakapo"       "Kakariki"     "Kea"          "Kereru"       "Kereru_orig"  "Korimako"    
[10] "Korora"       "Kotare"       "Putangitangi" "Takahe"       "Takapu"       "Titipounamu"  "Tui"          "Pepetuna"     "Pohutukawa"  

A helper function get_pal() returns the desited colour palette as a vector: For example:

get_pal("Hihi")
[1] "#070604" "#F9E211" "#797A87" "#A8ACAD" "#D6CBB5"

There is also a helper function called print_pal() which displays the palette in the graphics window.

hoiho <- get_pal("Hoiho")
print_pal(hoiho)

Since the get_pal() function returns the colour palettes as a character vector they can easily be used in the graphics package of your choice. Here are examples in both base R and ggplot2.

# Base R implementation
plot(mtcars$disp, mtcars$hp, col = get_pal("Hoiho")[factor(mtcars$carb)], pch = 19, cex = 3 )

# ggplot2 implementation
library(ggplot2)
ggplot(mtcars, aes(disp, hp, colour = factor(carb))) +
   geom_point(size = 3) +
   scale_colour_manual(values = get_pal("Hoiho"))

Colour palettes


Graphs shown below used to illustrate the colour templates use data from the nzcensr, palmerpenguins and gapminder packages.

Hihi - Notiomystis cincta - Stichbird

c("#070604", "#F9E211", "#797A87", "#A8ACAD", "#D6CBB5")

Photo:“Stitchbird (Notiomystis cincta)” by David Cook Wildlife Photography is licensed under CC BY-NC 2.0

Hoiho - Megadyptes antipodes - Yellow-eyed penguin

c("#CABEE9", "#7C7189", "#FAE093", "#D04E59", "#BC8E7D", "#2F3D70")

Photo:“Yellow-eyed penguin (Megadyptes antipodes)” by Bernard Spragg is licensed under CC0 1.0

Kākā - Nestor meridionalis

c("#A7473A", "#4B5F6C", "#B09B37", "#955F47", "#A8B9CB")

Photo:“Kākā” contributed by David Hood

Kākāpō - Strigops habroptilus

c("#7D9D33", "#CED38C", "#DCC949", "#BCA888", "#CD8862", "#775B24")

Photo:“Kākāpō” contributed by Dr Andrew Digby

Kākāriki - Cyanoramphus Spp.

c("#44781E", "#A1B654", "#2C3B75", "#B8321A", "#565052")

Photo:“Kākāriki” by SidPix is licensed under CC BY 2.0

Kea - Nestor notabilis

c("#6C803A", "#7B5C34", "#AB7C47", "#CCAE42", "#D73202",  "#272318", "#D3CDBF")

Photo:“Kea. New Zealand Alpine Parrot. (Nestor notabilis)” by Bernard Spragg is licensed under CC0 1.0

Kererū - Hemiphaga novaeseelandiae - NZ wood pigeon

c("#325756", "#7d9fc2", "#C582B2", "#51806a", "#4d5f8e", "#A092B7")

Photo:“Kererū” contributed by Gir

The original mock up of a NZ bird colour palettes posted on Twitter included a Kererū palette which many said they liked. It was ultimately deemed to have too much green in it but it remains in the package as "Kereru_orig" if people still wish to use it.

c("#5a8b8a", "#337166", "#2C5F44", "#c47c94", "#43394C")

Korimako - Anthornis melanura - NZ bellbird

c("#757b16","#4F651D",  "#798C8B", "#2F638F", "#091A26", "#490B0A")

Photo:“Korimako” contributed by Gir

Kororā - Eudyptula minor - Little blue penguin

c("#85BEDC",  "#3A383F", "#A6B0BB", "#CCBBCD", "#647588")

Photo:“Blue Penguin” by Syd3r is licensed under CC BY-NC-SA 2.0

Kōtare - Todiramphus sanctus - Kingfisher

c("#214d65", "#287DAB", "#E5BF86", "#B09771", "#624B27", "#CACFD0")

Photo:“Sacred Kingfisher (Todiramphus sanctus)” by Wade Tregaskis is licensed under CC BY-NC 2.0

Pūtangitangi - Tadorna variegata -paradise shelduck

c("#AA988A", "#B66A40", "#2F414B", "#2B4B3C", "#7A3520", "#7B8BA5")

Photo:File:Paradise-Shelduck-pair.jpg by Michael Hamilton is licensed under CC BY-SA 2.0

Takahē - Porphyrio hochstetteri

c("#DD3C51", "#313657", "#1F6683", "#6C90B9", "#D1C7B5")

Photo:“Takahē” by Kathrin & Stefan is licensed under CC BY-NC-ND 2.0</a

Takapu - Morus serrator - Australasian gannet

c("#DEB478", "#976533", "#D3D5D0","#76716E","#272623")

Photo:“New Zealand 2006/2007” by Travelling Pooh is licensed under CC BY-NC-ND 2.0

Titipounamu - Acanthisitta chloris - Rifleman

c("#3E4331", "#AD6B17", "#66743B", "#D0C471", "#CCB62F", "#BAC4C2")

Photo:“Rifleman (Titipounamu)” by vil.sandi is licensed under CC BY-ND 2.0

Tūī - Prosthemadera novaeseelandiae

c("#7ACCD7", "#115896", "#7C6C65", "#4C4C53", "#BA2F00", "#21282F")

Photo (left):“Tūī” contributed by Te Mihinga<; Photo (right):“Tūī feeding on Harakeke nectar” by SidPix is licensed under CC BY 2.0

Non-avian additions


Pepetuna - Aenetus virescens - Puriri moth

c("#719E56", "#71702F", "#947163", "#623711", "#425266")

Photo:“Puriri Moth - closeup” by Stefan Marks is licensed under CC BY-NC-ND 2.0

Pōhutukawa - Metrosideros excelsa

c("#5FA1F7", "#83A552", "#3D4928", "#9B1F1A", "#B19F8E", "#4E0B0C")

Photo:“Pohutukawa” by iainurquhart is licensed under CC BY 2.0

Continuous colour palettes


The colour palettes in this package are designed for discrete variables. However if your data is continuous and needs to be plotted as such (e.g. heatmaps) you can use the colorRampPalette() already part of your R installation to create a colour gradient.

For example, if you would like to create a colour gradient between the 2nd and 3rd colours from the Kotare palette you could do the following.

# Select 2nd and 3rd colours
selected_colours <- get_pal("Kotare")[c(2,3)]
# Create a gradient of 100 colours between the selected colours
colorRampPalette(selected_colours)(100)

This can be done with more than two colours too! For example, with three:

# Select 3 colours from the Kākā palette 
selected_colours <- get_pal("Kaka")[c(1,3,5)]
# Create a gradient of 100 colours between the selected colours
colorRampPalette(selected_colours)(100)

Accessibility


This package is intended to be a fun addition tool for R data visualisation and was limited to colours which could be extracted from the selected photos. Efforts were made to make these usable as colour palettes, but they do not conform to the Web Content Accessibility Guidelines (WCAG) with regards to clevels of colour contrast.

The developer also does not experience colour vision deficiency but checked simulated palettes using the Prismatic package. If this is a consideration in your visualisation then the Hihi, Kotare, Takapu or Tui palettes might be the most suitable.

Acknowledgements


Thanks go to Dr Tara McAllister (@taramcallister4) for conceiving of this idea and for helping to collect photos. Thank you also to all those on Twitter who shared their photos or expressed interest and support.

The wesanderson colour paltette package, created by Karthik Ram (@_inundata) should also be acknowledged as this package draws heavily from it.

The logo is adapted from the Pigeon icon by Nicole Macdonald and made avaliable under a Creative Commons CCBY lisense. Here colour and the title have been added.

Contribute


If you would like to improve or add to this package feel free to file an issue or pull request of Github or contact @GojThomson on Twitter.