BrewerClusterCol {Heatplus}R Documentation

Color scheme for clusters

Description

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.

Usage

BrewerClusterCol(n, name="Pastel1")

Arguments

n

desired number of colors

name

name of the qualitative palette from which colors are taken, see brewer.pal.info

Details

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.

Value

A character vector of length n of hexadecimal color codes.

See Also

brewer.pal

Examples

## 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"))


[Package Heatplus version 2.32.1 Index]