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 characteristic of these birds.
This package was the idea of Dr Tara McAllister (@taramcallister4) and is implemented like thewesanderson
colour palette package, created by Karthik Ram (@_inundata).
Photo:“Kererū” contributed by Tony Stoddard of KererūDiscovery (@KereruDiscovery)
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 available palettes like so:
library(Manu)
names(manu_palettes)
1] "Hihi" "Hoiho" "Kaka" "Kakapo" "Kakariki" "Kea" "Kereru" "Kereru_orig" "Kiwi" "Kokako"
[11] "Korimako" "Korora" "Kotare" "Putangitangi" "Takahe" "Takapu" "Titipounamu" "Tui" "Pepetuna" "Pohutukawa"
[21] "Gloomy_Nudi" [
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.
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.
c("#070604", "#F9E211", "#797A87", "#A8ACAD", "#D6CBB5")
Photo:“Stitchbird (Notiomystis cincta)” by David Cook Wildlife Photography is licensed under CC BY-NC 2.0
c("#CABEE9", "#7C7189", "#FAE093", "#D04E59", "#BC8E7D", "#2F3D70")
Photo:“Yellow-eyed penguin (Megadyptes antipodes)” by Bernard Spragg is licensed under CC0 1.0
c("#A7473A", "#4B5F6C", "#B09B37", "#955F47", "#A8B9CB")
Photo:“Kākā” contributed by David Hood
c("#7D9D33", "#CED38C", "#DCC949", "#BCA888", "#CD8862", "#775B24")
Photo:“Kākāpō” contributed by Dr Andrew Digby
c("#44781E", "#A1B654", "#2C3B75", "#B8321A", "#565052")
Photo:“Kākāriki” by SidPix is licensed under CC BY 2.0
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
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")
c("#3e2926", "#634c54", "#8b7162", "#a9a196", "#cfae9f", "#d3bac0")
Photo:“Kiwi at Kiwi Birdlife Park Queenstown” by Larry Koester is licensed under CC BY 2.0
c("#121f25", "#0042d6", "#5e89ab", "#b9d5eb", "#746455")
Photo:“Miharo & Freedom” sourced from Pirongia Te Aroaro o Kahu Restoration Society
c("#757b16","#4F651D", "#798C8B", "#2F638F", "#091A26", "#490B0A")
Photo:“Korimako” contributed by Gir
c("#85BEDC", "#3A383F", "#A6B0BB", "#CCBBCD", "#647588")
Photo:“Blue Penguin” by Syd3r is licensed under CC BY-NC-SA 2.0
c("#214d65", "#287DAB", "#E5BF86", "#B09771", "#624B27", "#CACFD0")
Photo:“Sacred Kingfisher (Todiramphus sanctus)” by Wade Tregaskis is licensed under CC BY-NC 2.0
c("#AA988A", "#B66A40", "#2F414B", "#2B4B3C", "#7A3520", "#7B8BA5")
Photo:“File:Paradise-Shelduck-pair.jpg” by Michael Hamilton is licensed under CC BY-SA 2.0
c("#DD3C51", "#313657", "#1F6683", "#6C90B9", "#D1C7B5")
Photo:“Takahē” by Kathrin & Stefan is licensed under CC BY-NC-ND 2.0
c("#DEB478", "#976533", "#D3D5D0","#76716E","#272623")
Photo:“New Zealand 2006/2007” by Travelling Pooh is licensed under CC BY-NC-ND 2.0
c("#3E4331", "#AD6B17", "#66743B", "#D0C471", "#CCB62F", "#BAC4C2")
Photo:“Rifleman (Titipounamu)” by vil.sandi is licensed under CC BY-ND 2.0
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
c("#719E56", "#71702F", "#947163", "#623711", "#425266")
Photo:“Puriri Moth - closeup” by Stefan Marks is licensed under CC BY-NC-ND 2.0
c("#5FA1F7", "#83A552", "#3D4928", "#9B1F1A", "#B19F8E", "#4E0B0C")
Photo:“Pohutukawa” by iainurquhart is licensed under CC BY 2.0
c("#3399ff", "#666600", "#003399", "#999900", "#000000")
Photo:“Tambja nudibranch pair” by Anna Barnett is licensed under CC BY 2.0
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)
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 levels 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
, Kokako
or Tui
palettes might be the most suitable.
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 palette 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 available under a Creative Commons CCBY license. Here colour and the title have been added.
If you would like to improve or add to this package feel free to file an issue or pull request on Github or contact @GojThomson on Twitter.