MyNixOS website logo
Description

Distinct Colour Palettes Based on 'iwanthue'.

Creating effective colour palettes for figures is challenging. This package generates and plot palettes of optimally distinct colours in perceptually uniform colour space, based on 'iwanthue' <http://tools.medialab.sciences-po.fr/iwanthue/>. This is done through k-means clustering of CIE Lab colour space, according to user-selected constraints on hue, chroma, and lightness.

hues

Travis-CI BuildStatus CRAN

This package generates and plot palettes of optimally distinct colours in perceptually uniform colour space, based on iwanthue. This is done through k-means clustering of CIE Lab colour space, according to user-selected constraints on hue, chroma, and lightness.

iwanthue palettes can be added directly onto ggplot2 objects via the function scale_colour_iwanthue.

Installation

The current CRAN version of hues can be installed with:

install.packages('hues')

The development version of hues can be installed using install_github from the devtools package:

# install.packages('devtools') # uncomment if devtools isn't already installed
devtools::install_github('johnbaums/hues')

Examples

The examples below show palettes corresponding to some presets given at the iwanthue website.

library(hues)
iwanthue(5, plot=TRUE)

iwanthue(5, 0, 240, 0, 24, 0, 100, plot=TRUE)    # shades

iwanthue(5, 0, 360, 0, 54, 67, 100, plot=TRUE)   # pastel

iwanthue(5, 0, 360, 54, 180, 27, 67, plot=TRUE)  # pimp

iwanthue(5, 0, 360, 36, 180, 13, 73, plot=TRUE)  # intense

iwanthue(3, 0, 300, 60, 180, 73, 100, plot=TRUE) # fluoro

iwanthue(3, 220, 260, 12, 150, 0, 53, plot=TRUE) # blue ocean

ggplot2 integration

library(ggplot2)
ggplot(iris, aes(x=Petal.Width, y=Petal.Length)) +
  geom_point(aes(color=Species), size=3) + 
  scale_colour_iwanthue()

ggplot(iris, aes(x=Petal.Width, y=Petal.Length)) +
  geom_point(aes(color=Species), size=3) + 
  scale_colour_iwanthue(hmax = 90)

ggplot(iris, aes(x=Petal.Width, y=Petal.Length)) +
  geom_point(aes(color=Species), size=3) + 
  scale_colour_iwanthue(hmin=0, hmax=300, cmin=60, cmax=180, lmin=73, lmax=100)

Metadata

Version

0.2.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows