piratepal

Share:

Description

This function provides a number of color palettes

Usage

1
2
piratepal(palette = "all", trans = 0, plot.result = FALSE,
  length.out = NULL)

Arguments

palette

A string defining the color palette to use (see examples). To use a random palette, use "random". To plot all palettes, use "all". To see all palette names, use "names"

trans

A number in the interval [0, 1] indicating how transparent to make the colors. A value of 0 means no transparency and a value of 1 means completely transparency.

plot.result

A logical value indicating whether or not to display the colors.

length.out

An integer indicating how many colors to return. If length.out is larger than the number of colors in the palette, colors will be repeated.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Check out the vignette for a full guide

vignette("piratepal", package = "yarrr")

# Show all palettes

piratepal(palette = "all")

# Show some palettes

piratepal(palette = "basel", trans = .5, plot.result = TRUE)


# Using a palette in a scatterplot

nemo.cols <- piratepal(palette = "nemo",  trans = .5)

set.seed(100) # For reproducibility
x <- rnorm(100)
y <- x + rnorm(100)

plot(x = x, y = y, col = nemo.cols,
    pch = 16,
    cex = runif(100, min = 0, max = 2),
    main = "piratepal('nemo', trans = .5)")