R Color Chart 5


Grid of 100 Named Colors in R Graphics

Grid of 100 Named Colors in R Graphics


# ==============================================================================
#                    Display All Built-in Color Names and Colors
#
# This script sets up a 10x10 grid to display 100 built in colors at a time. It
# uses a custom function to set out all of the colors in 7 plots.
#
#                                                 Kurt Taylor Gaubatz
#                                                 February, 2014
#
# ==============================================================================
# 
# Function for plotting a grid of colors with names. The only argument required
# is the starting number of the colors to display. There are 657 R colors, so
# we'll need to generate 7 plots to display them all. The colors listed in the  
# colors() function are in alphabetical order, so we'll demonstrate a regular
# expression grep() search to move the 200 gray/grey shades to the end.
#
# We pull out the grays with a somewhat complex regular expression.  This is 
# necessary because there are some colors like "bluegray" that we want to leave
# in. So, here is the regular expression search: grep("\\