如何使用nvd3和分类xaxs绘制带有rcharts的折线图?我想要做的就是像ggplot2一样:
library(ggplot2)
dat <- data.frame(expand.grid(group = letters[1:3], x = letters[4:6]), y = rnorm(9))
ggplot(dat, aes(x = x, y = y, group = group, color = group)) + geom_line()
我试过了:
library(rCharts)
nPlot(y ~ x, group = 'group', data = dat, type = 'lineChart')
我知道我可以将x更改为数字变量,但是xaxis标签将无法正确写入。
答案 0 :(得分:1)
这就是你所追求的?
foo <- hPlot(x = "x", y = "y", groups = "group", data = dat, type = "line")
foo