0
我無法使用數據框中存在的RGB顏色。R圖:使用數據幀中的RGB值
color.table
V1 V2 V3
1 Red 255,0,0
2 Orange Red 255,69,0
3 LimeGreen 50,205,50
4 Green 0,128,0
5 DarkGreen 0,100,0
6 GreenYellow 194,225,5
7 Yellow 255,255,0
8 Aquamarine 102,205,170
9 PaleTurquoise 138,145,208
10 IndianRed 205,92,92
11 DarkSalmon 233,150,122
12 DarkKhaki 189,183,107
13 Silver 128,128,128
14 Gainsboro 192,192,192
15 White 255,255,255
看來我不能使用此數據框中存在的RGB。
barplot(seq(1:15) , col=color.table$V3)
Error in rect(y1, x1, y2, x2, ...) :
invalid color specification "255,0,0"
即使我嘗試轉換十六進制值的RGB,有一些奇怪的。
rgb(color.table$V3[1], 50, m=255)
Error in rgb(color.table$V3[1], 50, m = 255) :
argument "blue" is missing, with no default
凡爲這個工程:
> rgb(255,0,0, 50, m=255)
[1] "#FF000032"
有有鬼這裏,但我不能把我的手指上。任何建議非常感謝。
當你在'rgb'查找文檔時,你能解釋當你運行'rgb(color.table $ V5 [1],50,m = 255 )'? – joran 2015-03-31 15:18:00
我想我是通過這個:'rgb(255,0,0,50,m = 255)' – 2015-03-31 15:20:36
那麼,'color.table $ V5 [1]'只是一個值,而不是三個。所以你基本上完成了'rgb(red = color.table $ V5 [1],green = 50,maxColorValues = 1)',由於位置和部分參數匹配。 – joran 2015-03-31 15:21:16