Giter Club home page Giter Club logo

hues's Introduction

hues

Travis-CI Build Status 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 functions scale_colour_iwanthue() and scale_fill_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)

hues's People

Contributors

johnbaums avatar rdinnager avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.