polychart

Manually set point colors in rCharts + polychart

我的未来我决定 提交于 2019-12-10 23:47:03
问题 I try to build a chart using rCharts and polychart frontend: dtf <- data.frame(x=c(1, 2, 3, 4, 5), y=c(4, 5, 6, 3, 5), label=c('one', 'two', 'one', 'two', 'two')) color.mapping <- list(one='#ff2385', two='#229922') p2 <- rPlot(x='x', y='y', data=dtf, type='point', color='label') print(p2) I would like to have a control over the point colors by either using some sort of discrete mapping (like in the example above) or using some other logic. How is that done EDIT following the Ramnath's answer