tricolor | R Documentation |
Function provides colour values for SOM units in such a way that the colour changes smoothly in every direction.
tricolor(grid, phis = c(0, 2 * pi/3, 4 * pi/3), offset = 0)
grid |
An object of class |
phis |
A vector of three rotation angles. Values for red, green and blue are given by the y-coordinate of the units after rotation with these three angles, respectively. The default corresponds to (approximate) red colour of the middle unit in the top row, and pure green and blue colours in the bottom left and right units, respectively. In case of a triangular map, the top unit is pure red. |
offset |
Defines the minimal value in the RGB colour definition (default is 0). By supplying a value in the range [0, .9], pastel-like colours are provided. |
Returns a matrix with three columns corresponding to red, green and
blue. This can be used in the rgb
function to provide colours
for the units.
Ron Wehrens
plot.kohonen
data(wines)
som.wines <- som(wines, grid = somgrid(5, 5, "hexagonal"))
colour1 <- tricolor(som.wines$grid)
plot(som.wines, "mapping", bg = rgb(colour1))
colour2 <- tricolor(som.wines$grid, phi = c(pi/6, 0, -pi/6))
plot(som.wines, "mapping", bg = rgb(colour2))
colour3 <- tricolor(som.wines$grid, phi = c(pi/6, 0, -pi/6), offset = .5)
plot(som.wines, "mapping", bg = rgb(colour3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.