ciftiTools (version 0.1.6.0)

make_color_pal: Make a color palette.

Description

Control the mapping of values to colors with colors, color_mode, and zlim.

Usage

make_color_pal(
  colors = NULL,
  color_mode = c("sequential", "qualitative", "diverging"),
  zlim = NULL,
  DATA_MIN = 0,
  DATA_MAX = 1
)

Arguments

colors

(Optional) "ROY_BIG_BL", the name of a ColorBrewer palette (see RColorBrewer::brewer.pal.info and colorbrewer2.org), or a character vector of colors. NULL (default) will use "ROY_BIG_BL" if color_mode is "sequential" or "diverging", and "Set2" if color_mode is "qualitative". See the description for more details.

color_mode

(Optional) "sequential", "qualitative", or "diverging". Default: "sequential". See the description for more details.

zlim

(Optional) Controls the mapping of values to each color in colors. If the length is longer than one, using -Inf will set the value to DATA_MIN, and Inf will set the value to DATA_MAX. See the description for more details.

DATA_MIN

(Optional) The minimum value of the data to make the palette for. Overrided by certain zlim.

DATA_MAX

(Optional) The maximum value of the data to make the palette for. Overrided by certain zlim.

Value

A data.frame with two columns: "color" (character: color hex codes) and "value" (numeric)

Details

There are three argument types for colors: "ROY_BIG_BL", the name of an RColorBrewer palette, or a character vector of color names.

If colors=="ROY_BIG_BL", the "ROY_BIG_BL" pallete will be used. It is the same palette as the default used in the Connectome Workbench application (see github.com/Washington-University/workbench/blob/master/src/Files/PaletteFile.cxx). The midpoint will be olored black. From the midpoint toward the upper bound, colors will proceed from black to red to yellow. From the midpoint toward the lower bound, colors will proceed from black to blue to purple to green to aqua. Note that these colors are not equally-spaced, and the bottom 0.5% of the color range has the same color. Here is how each color mode behaves if colors=="ROY_BIG_BL":

color_mode=="sequential"

Only the second half of the pallete will be used (black --> red --> yellow). If identical(zlim, NULL), the colors will be mapped between DATA_MIN (black) to DATA_MAX (yellow). If length(zlim)==2, zlim[1] will be the lower bound (black) and zlim[2] will be the upper bound (yellow). If zlim[1] > zlim[2], the first value will be used as the maximum and the second will be used as the minimum, and the color scale will be reversed with the highest value colored black and the lowest value colored yellow.

color_mode=="qualitative"

The "ROY_BIG_BL" pallete is not recommended for qualitative data, so a warning will be issued. Colors will be based on the landmark colors in the "ROY_BIG_BL" pallete. If identical(zlim, NULL), the colors will be mapped onto each integer between DATA_MIN and DATA_MAX, inclusive. Color interpolation will be used if the number of colors in the palette (17) is less than this range. If length(zlim)==length(colors), each color will be mapped to each corresponding value.

color_mode=="diverging"

If identical(zlim, NULL), the colors will be mapped from DATA_MIN (aqua) to DATA_MAX (yellow). If length(zlim)==1, this value will be used as the midpoint (black) instead of the data midpoint. If length(zlim)==2, zlim[1] will be the lower bound (aqua) and zlim[2] will be the upper bound (yellow). If length(zlim)==3, these values will correspond to the lowest bound (aqua), midpoint (black), and upper bound (yellow) respectively. If the zlim are in descending order, the first value will be used as the maximum and the last will be used as the minimum, and the color scale will be reversed with the highest values colored aqua and the lowest values colored yellow.

If colors is the name of an RColorBrewer palette (see RColorBrewer::brewer.pal.info), the colors in that pallete will be used, and the following behavior applies. If colors is a character vector of color names (hex codes or standard R color names), the below behavior applies directly:

color_mode=="sequential"

If identical(zlim, NULL), the colors will be mapped with equal spacing from DATA_MIN to DATA_MAX. If length(zlim)==2, these values will be used as the upper and lower bounds instead. If zlim[1] > zlim[2], the first value will be used as the maximum and the second will be used as the minimum, and the color scale will be reversed. If length(zlim)==length(colors), each color will be mapped to each corresponding value.

color_mode=="qualitative"

If identical(zlim, NULL), the colors will be mapped onto each integer between DATA_MIN and DATA_MAX, inclusive. Color interpolation will be used if the number of colors in the palette is less than this range. If length(zlim)==length(colors), each color will be mapped to each corresponding value.

color_mode=="diverging"

If identical(zlim, NULL), the colors will be mapped with equal spacing from DATA_MIN to DATA_MAX. Thus, the middle color will correspond to the midpoint of the data. If length(zlim)==1, the middle color will correspond to this value instead. The preceeding colors will be equally-spaced between DATA_MIN and this value; the following colors will be equally-spaced between this value andDATA_MAX. If length(zlim)==2, zlim[1] will be the lower bound (first color) and zlim[2] will be the upper bound (last color). If length(zlim)==3, these values will correspond to the lowest bound, midpoint, and upper bound respectively. There must be an odd number of colors, since the diverging color mode requires a midpoint. If the zlim are in descending order, the first value will be used as the maximum and the last will be used as the minimum, and the color scale will be reversed. Finally, if length(zlim)==length(colors), each color will be mapped to each corresponding value. Thus, the middle color will correspond to the middle color_value. The length of colors must be odd and >= 3.