Data Science Desktop Survival Guide
by Graham Williams |
|||||
Colour Ranges |
20200608
Automatic colour ranges are supported using grDevices::palette(), as the default palette. A contiguous colour palette is available as grDevices::cm.colors(), with a rainbow available as grDevices::rainbow(). Others palletes includegrDevices::gray(), which provides a gray scale, colorRamps::blue2green2red(), and RColorBrewer::brewer.pal().
blue2green2red(15)
Use graphics::image() to display the colour plots as above.
|
image(matrix(1:80, 10), col=palette())
image(matrix(1:100, 10), col=cm.colors(10)) image(matrix(1:100, 10), col=rainbow(10)) image(matrix(1:60, 10), col=gray(seq(0.1, 0.9, len=6))) image(matrix(1:150, 10), col=blue2green2red(15)) image(matrix(1:110, 10), col=brewer.pal(11, "PRGn")) image(matrix(1:110, 10), col=brewer.pal(11, "RdBu")) image(matrix(1:80, 10), col=brewer.pal(8, "Accent")) image(matrix(1:80, 10), col=brewer.pal(8, "Dark2")) image(matrix(1:90, 10), col=brewer.pal(9, "Pastel1")) image(matrix(1:120, 10), col=brewer.pal(12, "Paired")) image(matrix(1:120, 10), col=brewer.pal(12, "Set3"))
|