项目作者: vikjam

项目描述 :
Provides color palettes for R from great painters based on http://colorlisa.com/.
高级语言: R
项目地址: git://github.com/vikjam/RColorLisa.git
创建时间: 2016-05-02T01:03:00Z
项目社区:https://github.com/vikjam/RColorLisa

开源协议:MIT License

下载


RColorLisa

Easily load color palettes from great painters into R. Based on the work of Ryan McGuire who created the beautiful site Color Lisa.

Installation

  1. devtools::install_github("vikjam/RColorLisa")

Usage

Examples

  1. # Create a sequential palette for usage and show colors
  2. library(RColorLisa)
  3. pretty.palette <- color.lisa.pal(5, "The Dream by Pablo Picasso")
  4. image(1:5, 1, as.matrix(1:5), col = pretty.palette, xlab = "The Dream by Pablo Picasso",
  5. ylab = "", xaxt = "n", yaxt = "n", bty = "n")

the-dream

  1. # ggplot2 example
  2. library(ggplot2)
  3. library(RColorLisa)
  4. df <- data.frame(x = rep(c(2, 5, 7, 9, 12), 2),
  5. y = rep(c(1, 2), each = 5),
  6. z = factor(rep(1:5, each = 2)))
  7. escher.pal <- color.lisa.pal(5, "Gravity by M.C. Escher")
  8. ggplot(df, aes(x, y)) + geom_tile(aes(fill = z)) +
  9. scale_fill_manual(values = escher.pal)

escher-tile

  1. # Slightly more practical ggplot2 example
  2. library(ggplot2)
  3. library(RColorLisa)
  4. ernst.pal <- color.lisa.pal(3, "Woman, Old Man, and Flower by Max Ernst")
  5. ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) +
  6. geom_point(size = 3) +
  7. scale_color_manual(values = ernst.pal)

iris-ernst

  1. # A gradient
  2. library(ggplot2)
  3. library(RColorLisa)
  4. rothko.pal <- color.lisa.pal(5, "Untitled (Orange, Yellow, Red) by Mark Rothko")
  5. ggplot(faithfuld, aes(waiting, eruptions)) +
  6. geom_raster(aes(fill = density), interpolate = TRUE) +
  7. scale_fill_gradientn(colours = rothko.pal)

faithful-rothko