I'm trying to produce multiple charts based on different values of a specific variable in rCharts, ideally using NVD3 (nPlot
). I believe this should be implementable using facets. However, I am unable to even get the example provided by rCharts to work:
p13 <- nPlot(mpg ~ wt, data = mtcars, group = "gear", type = "scatterChart")
p13$params$facet = "cyl"
p13$templates$script = system.file(
"/libraries/nvd3/layouts/nvd3FacetPlot.html",
package = "rCharts"
)
p13
This doesn't produce a chart for me. When I remove the p13$templates$script
line, I get a single chart, no different from when I had not set a facet parameter. Am I missing something? I'm confident if I can simply reproduce this code to make it work I can get my own chart to work. I've installed the latest version of rCharts as of today (2/28/16).
As a separate question (if that's allowable), how do I add a title to an nPlot
?