文檔仍在進行中,但比以往更接近。如果您選擇使用polycharts
(請確保您知道付費商業許可),那麼these examples可能會有所幫助。這是關於同一主題的another StackOverflow question。我在下面做了一個快速示例。
library(rCharts)
data(iris)
colnames(iris) <- sapply(colnames(iris), FUN = gsub, pattern = "\\.", replacement = "")
p5 <- rPlot(SepalWidth ~ SepalLength, data = iris, color = "Species", type = "point", height = 400)
# again match polychartjs example exactly to show how we can change axis and legend titles
p5$guides(color = list(scale = "#! function(value){
color_mapping = {versicolor: '#ff2385',setosa:'#229922',virginica:'#2B24D6'}
return color_mapping[value];
} !#"), y = list(title = "sepalWidth"), x = list(title = "sepalLength"))
p5$set(title = "Iris Flowers")
p5
如果您選擇使用其他庫,指定顏色將有所不同,請告訴我,我很樂意提供幫助。
謝謝。我之前讀過這個問題和答案。但在這個問題中,它是關於重新映射來自分組的某些默認顏色(如'Species')。但我想爲不同的點提供不同的顏色(所以我在顏色矢量中有大約1000個元素)。我認爲我的情況不同,這就是爲什麼我問。當我提到文檔時,我的意思是,例如,我不知道如何使用'p $ guides'或'p $ set'。 – ziyuang 2014-09-19 05:05:04
你想爲每個點指定一個獨特的顏色嗎?你想要做一個漸變? – timelyportfolio 2014-09-19 13:39:58
文檔的主要問題是我無法在'polycharts'中找到如何操作。如果你知道如何在'polycharts'中做,那麼翻譯起來相當容易。 – timelyportfolio 2014-09-19 13:48:27