Description Usage Arguments Value Author(s) See Also Examples
qpal
creates qualitative color palettes using the HCL color space.
Qualitative color palettes consist of a set of discrete colors that are
suitable for categorical data such as barcharts or distinguishing groups
in a scatterplot.
1 2 |
n |
number of colors to create |
hue.start |
starting hue value, should be in the interval [0, 360] |
hue.end |
ending hue value, should be in the interval [0, 360]. |
chroma |
chroma value, range of possible value depends on hue and luminance values. |
luminance |
luminance value, should be in the interval [0, 100]. |
direction |
direction to travel around the color wheel. 1 = clockwise -1 = counterclockwise. |
alpha |
transparency level defined on the interval [0, 1] where 0 = transparent and 1 = opaque |
fixup |
logical, should RGB value be corrected (see |
qpal
returns a vector of hex colors
Michael Malick
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 26 27 28 29 30 31 32 33 34 35 36 37 38 | plotpal(qpal(5))
plotpal(qpal(5, hue.start = 0))
plotpal(qpal(5, alpha = 0.5))
plotpal(qpal(5, hue.start = 140))
plotpal(qpal(10, hue.start = 0, hue.end = 240))
plotpal(qpal(10, hue.start = 0, hue.end = 100))
plotpal(qpal(10, hue.start = 235, hue.end = 10))
plotpal(qpal(10, hue.start = 235, hue.end = 10, dir = -1))
plotpal(qpal(5, chroma = 60))
plotpal(qpal(5, chroma = 20))
plotpal(qpal(5, luminance = 30))
plotpal(qpal(5, luminance = 80))
plotpal(qpal(100, luminance = seq(25, 90, length = 100)))
y1 <- rnorm(100)
y2 <- rnorm(100) + 2
y3 <- rnorm(100) + 4
mycol <- qpal(3)
plot(y1, type = "l", col = mycol[1], ylim = c(-3, 7))
lines(y2, col = mycol[2])
lines(y3, col = mycol[3])
mycol <- qpal(3, chroma = 90, luminance = 60)
plot(iris$Sepal.Length[iris$Species == "setosa"],
iris$Sepal.Width[iris$Species == "setosa"],
col = mycol[1], pch = 19, ylim = c(2, 5), xlim = c(4, 8),
ylab = "Sepal width", xlab = "Sepal length")
points(iris$Sepal.Length[iris$Species == "virginica"],
iris$Sepal.Width[iris$Species == "virginica"],
col = mycol[2], pch = 19)
points(iris$Sepal.Length[iris$Species == "versicolor"],
iris$Sepal.Width[iris$Species == "versicolor"],
col = mycol[3], pch = 19)
mycol <- qpal(3, alpha = 0.2)
plot(rnorm(300), col = mycol[1], pch = 19)
points(rnorm(300), col = mycol[2], pch = 19)
points(rnorm(300), col = mycol[3], pch = 19)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.