BrewerClusterCol: Color scheme for clusters

Description Usage Arguments Details Value See Also Examples

View source: R/annHeatmap.R

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

1
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

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

Heatplus documentation built on May 2, 2018, 4:03 a.m.