Description Usage Arguments Examples
This function provides a number of color palettes
1 2 |
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. |
mix.col |
string. An optional string representing a color to mix all colors in the palette with. |
mix.p |
numeric. A number in the interval [0, 1] indicating how much to mix the palette colors with the color in |
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. |
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)")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.