Abstract

The R package colorspace provides a flexible toolbox for selecting individual colors or color palettes, manipulating these colors, and employing them in statistical graphics and data visualizations. In particular, the package provides a broad range of color palettes based on the HCL (hue-chroma-luminance) color space. The three HCL dimensions have been shown to match those of the human visual system very well, thus facilitating intuitive selection of color palettes through trajectories in this space. Using the HCL color model, general strategies for three types of palettes are implemented: (1) Qualitative for coding categorical information, i.e., where no particular ordering of categories is available. (2) Sequential for coding ordered/numeric information, i.e., going from high to low (or vice versa). (3) Diverging for coding ordered/numeric information around a central neutral value, i.e., where colors diverge from neutral to two extremes. To aid selection and application of these palettes, the package also contains scales for use with ggplot2, shiny and tcltk apps for interactive exploration, visualizations of palette properties, accompanying manipulation utilities (like desaturation and lighten/darken), and emulation of color vision deficiencies. The shiny apps are also hosted online at http://hclwizard.org/.

Highlights

  • Color is an integral element of many statistical graphics and data visualizations

  • As the properties of a palette in terms of the perceptual dimensions hue, chroma, and luminance are not always clear from looking just at color swatches or graphics based on these palettes, the specplot() function provides an explicit display for the coordinates of the HCL trajectory associated with a palette

  • This paper provides an overview of the broad capabilities of the colorspace package for selecting individual colors or color palettes, manipulating these colors, and employing them in various kinds of visualizations

Read more

Summary

Introduction

Color is an integral element of many statistical graphics and data visualizations. colors should be carefully chosen to support all viewers in accessing the information displayed colorspace: Manipulating and Assessing Colors and Palettes. The colorspace package (Ihaka et al 2020) adopts a somewhat different approach that gives the user direct access to the construction principles underlying its palettes These are based on simple trajectories in the perceptually-based HCL (hue-chroma-luminance) color space (Wikipedia 2020e) whose axes match those of the human visual system very well: Hue (type of color, dominant wavelength), chroma (colorfulness), luminance (brightness), see Figure 1. Utilizing this color model the colorspace package can derive general and adaptable strategies for color palettes; manipulate individual colors and color palettes; and assess and visualize the properties of color palettes (beyond simple color swatches).

Choosing HCL-based color palettes
Usage with base graphics
Usage with ggplot2
Palette visualization and assessment
Color spaces
Implemented color spaces
Human color vision and the HCL color model
Utilities
Illustration of basic colorspace functionality
HCL-based color palettes
Qualitative palettes
Construction details
Registering your own palettes
Flexible diverging palettes
Approximating palettes from other packages
Color swatches
Trajectories in HCL space
Demonstration of statistical graphics
Color vision deficiency emulation
R functions
Illustration
Apps for choosing colors and palettes interactively
Choose palettes with the HCL color model
Choose individual colors with the HCL color model
Emulate color vision deficiencies
Color manipulation and utilities
Desaturation in HCL space
Lighten or darken colors
Adjust transparency of colors
Maximum chroma for given hue and luminance
Summary and discussion

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.