brewPalette | R Documentation |
creates colors palette from the RColorBrewer package. By default, it uses palette name="Paired".
brewPalette(n, alpha = 1)
n |
<integer> Number of different colors in the palette, minimum 3, maximum depending on palette. |
alpha |
<numeric> Value from [0,1] to tune color opacity. By default, 1 gives maximum opacity. |
Miquel Anglada Girotto
n = 2
plot(1:8, col = brewPalette(n), cex=5, pch=16)
n = 12
plot(1:n, col = brewPalette(n), cex=5, pch=16)
n = 8; alpha = 0.75
plot(1:100,sample(1:100), col=brewPalette(n,alpha), cex=5, pch=16)
n = 'this is not numeric'
plot(1:8, col = brewPalette(n), cex=5, pch=16) # should result in warning
n = -1
plot(1:8, col = brewPalette(n), cex=5, pch=16) # should result in warning
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.