文档仍在进行中,但比以往更接近。如果您选择使用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