<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/ochre-australia-themed-colour-palettes/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://ropensci.org/blog/2017/11/21/ochre/"> rOpenSci - open tools for open science</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p></p>
<p>The second rOpenSci <a rel="nofollow" href="http://ozunconf17.ropensci.org/" target="_blank">OzUnConf</a> was held in Melbourne Australia a few weeks ago. A diverse range of <a rel="nofollow" href="https://ropensci.org/blog/2017/10/31/ozunconf2017/" target="_blank">scientists, developers and general good-eggs</a> came together to make some R-magic happen and also learn a lot along the way. Before the conference began, a huge stack of projects were suggested on the unconf <a rel="nofollow" href="https://github.com/ropensci/ozunconf17/issues" target="_blank">GitHub repo</a>. For six data-visualisation enthusiasts, one issue in particular caught their eye, and the <code>ochRe</code> package was born.</p>
<p><img alt="" src="https://i1.wp.com/ropensci.org/img/blog-images/2017-11-21-ochRe/AusElevationExamplePalettes.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>The <a rel="nofollow" href="https://github.com/ropenscilabs/ochRe" target="_blank"><code>ochRe</code></a> package contains colour palettes influenced by the Australian landscape, iconic Australian artists and images. OchRe is originally the brain-child of <a rel="nofollow" href="https://twitter.com/visnut" target="_blank">Di Cook</a>, who was inspired by Karthik Ram’s <a rel="nofollow" href="https://github.com/karthik/wesanderson" target="_blank"><code>wesanderson</code></a> package.</p>
<h3>Why “ochre”?</h3>
<p>Naming our package was the “most important” task facing us after all jumping on board the project. Fuelled by a selection of pastries we opened the discussions, fully expecting this to take some time. Fortunately, we all agreed on the name in less than 5 minutes, which meant plenty of pastries were left for the serious business of package building.</p>
<p>Ochre is naturally occuring, brownish-yellow <a rel="nofollow" href="https://en.wikipedia.org/wiki/Ochre" target="_blank">pigment</a> found in many parts of Australia, so frequently in fact, that Australia is sometimes referred to as the “land of ochre soil”. Additionally, ochre pigment has been used for thousands of years by Aboriginal people in Australia, with many culturally important uses from artwork to the preservation of animal skins.</p>
<h3>Building ochRe</h3>
<p>We started our package building journey by each picking an iconic Australian artwork (this took longer than you might think). Once we had selected our images, we used the online <a rel="nofollow" href="http://www.coolphptools.com/color_extract" target="_blank">Image Color Extract PHP</a> demo tool to extract the hex code for the main colours within each image. Some images required a more selective approach, so where needed the colour code extraction was done using the eyedropper tool (in macOS) or the Google Chrome colourPick extension.</p>
<p>Once we were happy with the colours, codes and order for each palette we loaded this information into <code>ochRe</code> as lists of hex codes associated with the palette name. We adopted <code>scales</code> to improve the fucntionality of the packages when using <code>ggplot</code>, in particular to allow manipulation of colour ramping and transparency. The package also contains a few simple functions for displaying the different palettes.</p>
<p>Below are some examples of original art work and their associated palettes:</p>
<p><code>namatjira_qual</code> and <code>namatjira_div</code> are both inspired by the watercolour painting <a rel="nofollow" href="http://www.menziesartbrands.com/items/twin-ghosts" target="_blank">“Twin Ghosts”</a>, by Aboriginal artist Albert Namatjira. <code>namatjira_div</code> is ordered for plotting divergent datasets.</p>
<p><img alt="" src="https://i1.wp.com/ropensci.org/img/blog-images/2017-11-21-ochRe/TwinGhosts_AlbertNamatjira.jpg?w=456&ssl=1" data-recalc-dims="1"><br>
<img alt="" src="https://i0.wp.com/ropensci.org/img/blog-images/2017-11-21-ochRe/namatjira_qual.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>The <code>nolan_ned</code> palette is inspired by the famous paintings of the outlaw <a rel="nofollow" href="https://cs.nga.gov.au/detail.cfm?irn=28926" target="_blank">Ned Kelly</a> by Sidney Nolan.</p>
<p><img alt="" src="https://i0.wp.com/ropensci.org/img/blog-images/2017-11-21-ochRe/nedKelly_sidneyNolan.jpg?w=456&ssl=1" data-recalc-dims="1"><br>
<img alt="" src="https://i1.wp.com/ropensci.org/img/blog-images/2017-11-21-ochRe/nolan_ned.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p><code>olsen_seq</code> has been designed for plotting sequential data, such as a heat map or landscape layers. The colours come from the abstract piece <a rel="nofollow" href="https://artsearch.nga.gov.au/Detail-LRG.cfm?IRN=26102" target="_blank">“Sydney Sun”</a>, 1965, by John Olsen.</p>
<p><img alt="" src="https://i0.wp.com/ropensci.org/img/blog-images/2017-11-21-ochRe/sydneySun_johnOlsen.jpg?w=456&ssl=1" data-recalc-dims="1"><br>
<img alt="" src="https://i1.wp.com/ropensci.org/img/blog-images/2017-11-21-ochRe/olsen_seq.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>There was a high proportion of ecologists at the #ozunconf, which inspired the somewhat pessimistic <code>healthy_reef</code> and <code>dead_reef</code> palettes, with the colours taken from recent underwater photgraphs of the Great Barrier Reef.</p>
<h3>Introducing: <code>ochRe</code></h3>
<p>Our package currently contains 16 colour palettes, each one inspired by either an Australian landscape, an artwork or image by an Australian artist, or an Australian animal. Some of the palettes are more suited to displaying continuous data (such as in the Australian elevation maps above). Other palettes will perform best plotting discrete data (as in the <code>parliament</code> example below).</p>
<p><code>ochRe</code> can be currently be installed from GitHub:</p>
<pre><code># You need to install the 'devtools' package first
devtools::install_github(&quot;ropenscilabs/ochRe&quot;)
</code></pre>
<p>You can visualise all 16 palettes using the following code snippet:</p>
<pre><code>pal_names &lt;- names(ochre_palettes)

par(mfrow=c(length(ochre_palettes)/2, 2), lheight = 2, mar=rep(1, 4), adj = 0)
for (i in 1:length(ochre_palettes)){
    viz_palette(ochre_palettes[[i]], pal_names[i])
}
</code></pre>
<p><img alt="" src="https://i2.wp.com/ropensci.org/img/blog-images/2017-11-21-ochRe/ochrePalettes.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>Here are some worked examples, showing how to use the palettes for different types of data visualisation, including both <code>ggplot</code> and base plotting in R.</p>
<p>An example using base R and the <code>winmar</code> palette, this is based on an iconic photograph by Wayne Ludbey, “Nicky Winmar St Kilda Footballer”, 1993. In the photo, Aboriginal AFL player Nicky Winmar is baring his skin in response to racial abuse during an AFL game.</p>
<pre><code>## basic example code
pal &lt;- colorRampPalette(ochre_palettes[[&quot;winmar&quot;]])
image(volcano, col = pal(20))
</code></pre>
<p><img alt="" src="https://i1.wp.com/ropensci.org/img/blog-images/2017-11-21-ochRe/VolcanoWithWinmar.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>Paired scatter plot using the <code>emu_Woman_paired</code> palette, inspired by “Emu Woman”, 1988-89, by Emily Kame Kngwarreye.</p>
<pre><code>library(tidyverse)
library(ochRe)
library(naniar)

# Exploring missing values benefits from a paired palette, like the emu women
# Here missing status on air temperature is shown in a plot of the two wind variables
data(oceanbuoys)
oceanbuoys &lt;- oceanbuoys %>% add_shadow(humidity, air_temp_c) 
ggplot(oceanbuoys, aes(x=wind_ew, y=wind_ns, colour=air_temp_c_NA)) + 
    geom_point(alpha=0.8) + 
    scale_colour_ochre(palette=&quot;emu_woman_paired&quot;) +
    theme_bw() + theme(aspect.ratio=1)

# Slightly more complicated, forcing the pairs
clrs &lt;- ochre_palettes$emu_woman_paired[11:12]
ggplot(oceanbuoys, aes(x=wind_ew, y=wind_ns, colour=air_temp_c_NA)) + 
    geom_point(alpha=0.8) + 
    scale_colour_manual(values=clrs) +
    theme_bw() + theme(aspect.ratio=1)
</code></pre>
<p><img alt="" src="https://i2.wp.com/ropensci.org/img/blog-images/2017-11-21-ochRe/Ochre_Example1.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>A map of the Australian electoral boundaries, using the <code>galah</code> palette. <a rel="nofollow" href="https://en.wikipedia.org/wiki/Galah" target="_blank">Galahs</a> are a common species of cockatoo found throughout mainland Australia.</p>
<pre><code># Map of the 2016 Australian electoral boundaries
# with the galah palette
library(eechidna)
library(ggthemes)
data(nat_map_2016)
data(nat_data_2016)
ggplot(aes(map_id=id), data=nat_data_2016) +
    geom_map(aes(fill=Area_SqKm), map=nat_map_2016) +
    expand_limits(x=nat_map$long, y=nat_map$lat) + 
    scale_fill_ochre(palette=&quot;galah&quot;, discrete=FALSE) +
    theme_map()
</code></pre>
<p><img alt="" src="https://i2.wp.com/ropensci.org/img/blog-images/2017-11-21-ochRe/Ochre_Example2.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>Results of the 2016 Australian election to the senate, coloured by political party using the <code>parliament</code> palette. The colours for this palette were taken from the <a rel="nofollow" href="https://www.aph.gov.au/~/media/06%20Visit%20Parliament/66%20Parl%20House%20Art%20Collection/661%20five%20treasures/five%20treasures%20detail%20pics/M19840057UntitledBOYDunframed.png?la=en" target="_blank">tapestry</a> by Arthur Boyd found in the Great Hall of Parliament House.</p>
<pre><code># Election results
senate &lt;- read_csv(&quot;http://results.aec.gov.au/20499/Website/Downloads/SenateSenatorsElectedDownload-20499.csv&quot;, 
                   skip = 1)
coalition &lt;- c(&quot;Country Liberals (NT)&quot;, &quot;Liberal&quot;, &quot;Liberal National Party of Queensland&quot;, 
               &quot;The Nationals&quot;)
labor &lt;- c(&quot;Australian Labor Party&quot;, &quot;Australian Labor Party (Northern Territory) Branch&quot;, 
           &quot;Labor&quot;)
greens &lt;- c(&quot;The Greens&quot;, &quot;Australian Greens&quot;, &quot;The Greens (WA)&quot;)

senate &lt;- senate %>% mutate(PartyNm = ifelse(as.character(PartyNm) %in% coalition, 
                                             &quot;Liberal National Coalition&quot;, PartyNm))

senate &lt;- senate %>% mutate(PartyNm = ifelse(as.character(PartyNm) %in% labor, 
                                             &quot;Australian Labor Party&quot;, PartyNm))

senate &lt;- senate %>% mutate(PartyNm = ifelse(as.character(PartyNm) %in% greens, 
                                             &quot;Australian Greens&quot;, PartyNm))

senate$PartyNm &lt;- factor(senate$PartyNm, 
                         levels = names(sort(table(senate$PartyNm), 
                            decreasing = T)))

ggplot(data = senate, aes(x = PartyNm, fill = PartyNm)) + 
    geom_bar() + xlab(&quot;&quot;) + 
    ylab(&quot;&quot;) + scale_fill_ochre(palette=&quot;parliament&quot;) + coord_flip() + 
    theme_bw() + theme(legend.position = &quot;None&quot;) 
</code></pre>
<p><img alt="" src="https://i0.wp.com/ropensci.org/img/blog-images/2017-11-21-ochRe/Ochre_Example3.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>For more information about the individual palettes available in <code>ochRe</code> visit our <a rel="nofollow" href="https://github.com/ropenscilabs/ochRe/tree/master/vignettes" target="_blank">vignette</a></p>
<p>All of the <code>ochRe</code> team had a great time at #ozunconf, Thank you to the organisers for a brilliant event. Special Thanks to <a rel="nofollow" href="https://github.com/mdsumner" target="_blank">Michael Sumner</a> for providing code to access the Australian elevation map you see at the start of this post.</p>
<blockquote class="twitter-tweet" data-lang="en">
<p lang="en" dir="ltr">The Oz colour palette gang soakin it up outside <a rel="nofollow" href="https://twitter.com/hashtag/ozunconf?src=hash&ref_src=twsrc%5Etfw" target="_blank">#ozunconf</a> <a rel="nofollow" href="https://t.co/XiLkhwZwTv" target="_blank">pic.twitter.com/XiLkhwZwTv</a></p>
<p>— Miles McBain (@MilesMcBain) <a rel="nofollow" href="https://twitter.com/MilesMcBain/status/923682409400250368?ref_src=twsrc%5Etfw" target="_blank">October 26, 2017</a></p></blockquote>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://ropensci.org/blog/2017/11/21/ochre/"> rOpenSci - open tools for open science</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/MkiSsL9_xzo" height="1"></a></div>