• Stars
    star
    107
  • Rank 323,587 (Top 7 %)
  • Language
    HTML
  • License
    Other
  • Created almost 16 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

munsell colour system for R

Downloads

Travis build status

munsell

The munsell package provides easy access to, and manipulation of, the Munsell colours. The munsell package provides a mapping between Munsell's original notation (e.g. "5R 5/10") and hexadecimal sRGB strings suitable for use directly in R graphics. The package also provides utilities to explore slices through the Munsell colour tree, to transform Munsell colours and display colour palettes.

Munsell devised his system of colour notation to match the three perceptual dimensions of colour: hue, value and chroma. His notation provides a naming scheme to colours that eases the choice of color according to a specific purpose. His century old advice is still relevant for the producers of statistical graphics and the munsell package aims to enable user to easily follow it.

munsell relies directly on the published tables in Newhall, Nickerson, and Judd (1943) of CIE XYZ (Illuminant C) values for Munsell colours. These tables were the result of colour matching studies on Munsell's color samples along with some smoothing and extrapolation with Munsell's goal of perceptually uniform spacing in mind.

Currently the munsell package only includes hue in steps of 2.5, value in steps of 2 and chroma in steps of 1, corresponding directly to the entries in Table 1 in Newhall, Nickerson, and Judd (1943). If you require a more continuous mapping, see munsellinter.

Usage

Functions in munsell fall into three basic use categories: specifying Munsell colours, altering Munsell colours and exploring the Munsell color space.

The code below relies on the development version of munsell, get it with:

devtools::install_github("cwickham/munsell")

Color specification

Following Munsell, specifying colours is done with a specific string format: "H V/C" where H is a hue code (see mnsl_hues() for a list of those available, excluding "N"), V an integer in [0, 10] specifying value, and C an even integer specifying chroma. The mnsl function takes the string and returns a hexadecimal RGB representation:

library(munsell)
mnsl("5R 5/10")
#> [1] "#C65858"

Visually examining a colour can either be done by using mnsl with a base plotting call, or using plot_mnsl which plots colour swatches using ggplot2:

plot.new()
rect(0, 0, 1 ,1 , col = mnsl("5R 5/10"))
plot_mnsl("5R 5/10")

Colour manipulation

munsell provides convenience functions that alter a colour by taking steps in the hue, value and chroma dimensions: rygbp, pbgyr, lighter, darker, saturate and desaturate.

my_blue <- "5PB 5/8"
p <- plot_mnsl(c(
  lighter(my_blue, 2),      my_blue,   darker(my_blue, 2),
  desaturate(my_blue, 2),   my_blue,   saturate(my_blue, 2),
  rygbp(my_blue, 2),        my_blue,   pbgyr(my_blue, 2)))
p

Each function optionally takes the number of steps to take in the dimension and consequently are easily used to create scales in a particular dimension.

p <- plot_mnsl(sapply(0:6, darker, col = "5PB 7/4"))
p + ggplot2::facet_wrap(~ num, nrow = 1)

Colour space exploration

Slices through the colour space of constant hue, chroma or value can be displayed using the functions: hue_slice, chroma_slice and value_slice. Additionally complement_slice displays a slice of constant hue, alongside a slice of its complement, the hue that is on the opposite side of the colour sphere to that specified.

complement_slice("5R")

References

Newhall, Sidney M, Dorothy Nickerson, and Deane B Judd. 1943. β€œFinal Report of the Osa Subcommittee on the Spacing of the Munsell Colors.” JOSA 33 (7). Optical Society of America: 385–411.

More Repositories

1

purrr-tutorial

A introduction to purrr
R
250
star
2

data-science-in-tidyverse

Data Science in the tidyverse, a two-day workshop @ rstudio:conf(2018)
146
star
3

advanced-r

One day course covering functions, functional programming and tidy evaluation
R
42
star
4

quotation

Materials from a talk at the Eugene R Users meetup
38
star
5

r_intro_bc_stats

An Introduction to R and RStudio with the tidyverse delivered at BC Stats
TeX
35
star
6

data-science-in-tidyverse-solutions

Solutions for Data Science in the tidyverse
R
17
star
7

nass

R package for National Automotive Sampling System data
SAS
8
star
8

manuscript-template-rstudio

TeX
8
star
9

geospatial

R package for data used in the Working with Geospatial Data in R DataCamp course
R
7
star
10

human-side

Resources for talk "The Human Side of Data Science"
TeX
6
star
11

BerkeleyEarthR

R code to read BerkeleyEarth text files
R
6
star
12

genentech-build-tidy-tools

Materials for the Building Tidy Tools workshop at Genentech 2020
6
star
13

routes

R code for creating data art pieces documenting journeys
R
5
star
14

manuscript-showcase

Jupyter Notebook
4
star
15

r_intro_bc_stats_solutions

Solutions for Your Turns in the "Introduction to R with the tidyverse" course
3
star
16

beav-thesis

Quarto format for Oregon State University Theses
TeX
3
star
17

whats-new-in-quarto

HTML
2
star
18

streams

An teaching project to demonstrate dplyr::rowwise()
2
star
19

cRaggy

Code to generate 1-page summary for cRaggy graphics show-and-tell @ cascadiaRConf 2018
HTML
2
star
20

cnvs

Experimental R package to access Canvas LMS API based on gh
R
2
star
21

this-month-I-learned

JavaScript
2
star
22

wilcoxon

R
2
star
23

quarto-workshop-exercises

2
star
24

park_explorer

National Park Visit explorer app for the pluralsight course "Building Your First R Shiny App"
R
1
star
25

fifa-leagues

R
1
star
26

flights

Code for getting ontime data from BTS and into local postgreSQL database
R
1
star
27

streams-2

Teaching project with lots of repetition
1
star
28

submission-quarto-lite-r

R/QMD version of Notebooks Now! Quarto example
TeX
1
star
29

manuscript-template-jupyter

A template project for a Quarto Manuscript
Jupyter Notebook
1
star
30

manuscript-slides

CSS
1
star
31

qmd-embed

1
star
32

or-house-history

A place to put prototype visualizations
HTML
1
star
33

manuscript-template-vscode

TeX
1
star
34

oakridge

Slides and demo materials for a talk given at Oakridge National Labs
Jupyter Notebook
1
star
35

typst-greattables

1
star