Create a Vector of Colors from a Vector of Gray Levels in R Programming – gray() or grey() Function
Last Updated :
30 Jun, 2020
gray() or grey()
function in R Language is used to create a vector of colors from a vector of gray levels.
Syntax:
gray(level)
or
grey(level)
Parameters:
level: a vector of desired gray levels between 0 and 1; zero indicates “black” and one indicates “white”.
Example 1:
Output:
[1] "#000000"
[1] "#FFFFFF"
Example 2:
Output:
[1] "#000000" "#1C1C1C" "#393939" "#555555" "#717171" "#8E8E8E" "#AAAAAA"
[8] "#C6C6C6" "#E3E3E3" "#FFFFFF"
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...