Function to define a colormap

Share:

Description

visColormap is supposed to define a colormap. It returns a function, which will take an integer argument specifying how many colors interpolate the given colormap.

Usage

1
2
3
visColormap(colormap = c("bwr", "jet", "gbr", "wyr", "br", "yr",
"rainbow",
"wb"))

Arguments

colormap

short name for the colormap

Value

  • palette.name: a function that takes an integer argument for generating that number of colors interpolating the given sequence

Note

The input colormap includes:

  • "jet": jet colormap

  • "bwr": blue-white-red

  • "gbr": green-black-red

  • "wyr": white-yellow-red

  • "br": black-red

  • "yr": yellow-red

  • "wb": white-black

  • "rainbow": rainbow colormap, that is, red-yellow-green-cyan-blue-magenta

  • Alternatively, any hyphen-separated HTML color names, e.g. "blue-black-yellow", "royalblue-white-sandybrown", "darkblue-lightblue-lightyellow-darkorange", "darkgreen-white-darkviolet", "darkgreen-lightgreen-lightpink-darkred". A list of standard color names can be found in http://html-color-codes.info/color-names

See Also

visColoralpha

Examples

1
2
3
4
5
# 1) define "blue-white-red" colormap
palette.name <- visColormap(colormap="bwr")

# 2) use the return function "palette.name" to generate 10 colors spanning "bwr"
palette.name(10)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.