ez.palette: palette generator

View source: R/plot.R

ez.paletteR Documentation

palette generator

Description

palette generator

Usage

ez.palette(name, n, type = c("discrete", "continuous"), nn = 10)

Arguments

name

Name of desired palette. To see all colors, call ez.palette() with no parameter.

n

Number of colors desired. Unfortunately most palettes now only have 4 or 5 colors. But hopefully we'll add more palettes soon. All color schemes are derived from the most excellent Tumblr blog: Wes Anderson Palettes. If omitted, uses all colors

type

Either "continuous" or "discrete". Use continuous if you want to automatically interpolate between colors

nn

For a few palettes that natively support color interpolatation. See example below.

Value

A vector of colors. To see the colors, call show.color()

Examples

ez.palette("Royal1")
ez.palette("GrandBudapest1")
ez.palette("Cavalcanti1")
ez.palette("Cavalcanti1", 3)
show.color(ez.palette("Cavalcanti1", 3))

# If you need more colours than normally found in a palette, you
# can use a continuous palette to interpolate between existing
# colours
pal <- ez.palette(name = "Zissou1", 21, type = "continuous")
image(volcano, col = pal)

ez.palette('matlabcolor',nn=100)  # do not specify n and type
ez.palette('matlabcolor2',nn=100)
ez.palette('ggcolor',nn=10)
rep(ez.palette('ggcolor',nn=10),2)

# in action
qplot(Sepal.Length,
      Petal.Length,
      data = iris,
      color = Species,
      size = Petal.Width)+
theme_bw()+
scale_color_manual(values = ez.palette("GrandBudapest1",3))

jerryzhujian9/zmisc documentation built on March 9, 2024, 12:49 a.m.