Learn R Programming

qiimer (version 0.9.4)

saturated_rainbow: Saturated rainbow palette.

Description

This palette is specially designed for data consisting of counts. It is intended to show both presence/absence and relative proportion in the same plot. For data containing N counts in the largest sample, the saturated rainbow palette should be created with length N + 1.

Usage

saturated_rainbow(n, saturation_limit = 0.4)

Arguments

n
Length of the palette
saturation_limit
The fraction of the total palette length over which the rainbow extends. Above this limit, the color will remain the same.

Value

A vector of colors.

Details

The first element of the palette is white, indicating zero counts. The second element is dark blue, indicating one or very few counts. As the proportion increases within a sample, the palette transitions from blue to green, yellow, orange, and finally red.

The function defines a saturation limit, above which the color remains bright red. The saturation limit is set to 40 items with the largest relative proportion in a sample. The default value seems to work well for a wide range of circumstances -- it allows items that are strongly dominant in a sample to be identified across the plot. Ideally, the total number of red squares should be kept low, never more than one per sample.

Examples

Run this code
saturated_rainbow(5)

Run the code above in your browser using DataLab