26 Perception/Color Resources

26.1 Overview

This section has resources for learning about graphical perception and how to use colors effectively.

26.2 Perception

Here are some links to some key books/articles on perception:

26.3 Color

Color is very subjective. It is important to choose the right ones so that your work is easy to understand.

  • Color Brewer: Excellent resource for getting effective color palettes for different projects. Its main focus is on cartography, but it is super useful for any project involving color. You can choose between different types of data (sequential, diverging, qualitative), ensure your chosen palette is effective for colorblind users (or print friendly or photocopy safe), and easily export the color palette to different formats (Adobe, GIMP/Inkscape, JS, CSS). The best go-to for effective color palettes.
  • Color Oracle: Not sure how effective your project will be to a colorblind user? The Color Oracle tool can help. You can click to see how your screen would look to someone with various color vision deficiencies.
  • ColorPick Eyedropper: This Chrome extension allows you to copy hex color values from webpages. Simple and intuitive, it will make creating your awesome color palettes a lot easier.

26.4 Quick tips on using color with ggplot2

One of the most common problems is confusing color and fill. geom_point() and geom_line use color, many of the other geoms use fill. Some use both, such as geom_tile() in which case color is the border color and fill is the fill color.

26.4.1 Continuous data

ColorBrewer

  • scale_color_distiller(palette = "PuBu") or scale_fill_distiller(palette = "PuBu")

(What doesn’t work: scale_color_brewer(palette = "PuBu"))

Viridis

  • scale_color_viridis_c() or scale_fill... (the c stands for continuous)

Create your own

+ scale_color_gradient(low = "white", high = "red") or + scale_fill...

+ scale_color_gradient2(low = "red", mid = "white", high = "blue", midpoint = 50) or + scale_fill...

+ scale_color_gradientn(colours = c("red", "pink", "lightblue", "blue")) or scale_fill...

26.4.2 Discrete data

ColorBrewer

  • scale_color_brewer(palette = "PuBu") or scale_fill...

26.4.2.1 Viridis

  • scale_color_viridis_d() or scale_fill... (the d stands for discrete)

Create your own

+ scale_color_manual(values = c("red", "yellow", "blue")) or scale_fill...

+ scale_fill_manual(values = c("red", "yellow", "blue")) or scale_fill...







with