This function returns a color vector based on one of the qualitative paletters supported by
RColorBrewer. This allows visually distinct coloring of clusters and ensures sure that adjacent clusters have different colors.
desired number of colors
name of the qualitative palette from which colors are taken, see
This is just a wrapper for
brewer.pal that checks that the specified palette is qualitative, and allows for an arbitrary number of colors: for less than three colors, it just returns the first and second colors of the palette; for more than
maxcolors colors, it recycles the basic palette as often as required. This is ok, because the main point is to have different colors for neighboring clusters.
A character vector of length
n of hexadecimal color codes.
1 2 3 4 5 6 7 8 9 10 11
## A Color Wheel: default palette with maximum number of colors pie(rep(1,9), col=BrewerClusterCol(9)) ## Double the number of colors pie(rep(1,18), col=BrewerClusterCol(18)) ## Only two clusters/colors pie(rep(1,2), col=BrewerClusterCol(2)) ## Different qualitative palette: stronger colors pie(rep(1,12), col=BrewerClusterCol(12, "Paired"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.