R语言 获取所有657种颜色的列表 – colors()函数
R语言中的 color() 函数用于显示R编程中包含的所有657种颜色名称。
语法: colors()
参数:
不接受任何参数。
例子1:
# R program to illustrate
# colors function
# Calling the colors() function
# to show all the 657 colors that
# names are contained in
# R programming
colors()
输出:
[1] "white" "aliceblue" "antiquewhite"
[4] "antiquewhite1" "antiquewhite2" "antiquewhite3"
[7] "antiquewhite4" "aquamarine" "aquamarine1"
...
...
[655] "yellow3" "yellow4" "yellowgreen"
例2:
# R program to illustrate
# colors function
# Calling the colors() function
# with specific serial number of
# color names contained in R
# Programming
colors()[1]
colors()[3]
colors()[10]
colors()[655]
colors()[656]
输出:
[1] "white"
[1] "antiquewhite"
[1] "aquamarine2"
[1] "yellow3"
[1] "yellow4"