我试过了以下。我在RStudio中创建了一个R markdown文档(test.Rmd)并放入以下内容。
## Testing interactive graphics
```{r}
library(highcharter)
library(ggplot2)
data(diamonds, economics_long, mpg, package = "ggplot2")
hchart(mpg, "scatter", x = displ, y = hwy, group = class)
```
转换这个“test.Rmd”到“test.md”,最后到“test.html的”通过点击RStudio的Knit HTML
按钮或通过在控制台中运行以下脚本:
library(knitr)
knit("test.Rmd", tangle=F, encoding = "utf-8")
render("test.md",output_format=html_document())
这生成一个交互式图形的HTML文件。
是。这不是plotly
,但highcharter
是一个不错的R包,其中包括几个互动的JavaScript绘图库,它很容易使用。例如,它也比rCharts
更好。软件包维护人员对查询也很友好并且响应。安装highcharter
包在这里:
library(devtools)
install_github("jbkunst/highcharter")
来源
2016-07-31 10:14:06
rmf
我会检查出[的plotly护身符(https://github.com/ropensci/plotly/tree/master/vignettes),虽然他们不给我正确构建在RStudio中。 – alistaire