获取 R 编程中所有 657 种颜色的列表 – colors()函数
R 语言中的colors()函数用于显示R 编程中包含的所有657 种颜色名称。
Syntax: colors()
Parameters:
Does not accept any parameters.
示例 1:
Python3
# R program to illustrate
# colors function
# Calling the colors() function
# to show all the 657 colors that
# names are contained in
# R programming
colors()
Python3
# 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" "aliceblue" "antiquewhite"
[4] "antiquewhite1" "antiquewhite2" "antiquewhite3"
[7] "antiquewhite4" "aquamarine" "aquamarine1"
...
...
[655] "yellow3" "yellow4" "yellowgreen"
示例 2:
Python3
# 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"