【发布时间】:2017-05-31 09:57:04
【问题描述】:
我使用 R 和闪亮的库开发了一个仪表板,其中显示了一些不同的图表。这些不是静态图表,而是根据您可以通过某些按钮等设置的某些过滤器动态生成的。
下一步,我现在正在做的工作是创建一个包含我之前生成的图表的 powerpoint 报告。到目前为止,我得到了这段代码:
report <- pptx(template = 'report_template.pptx')
report <- addSlide(report,"report_layout")
slide.layouts(report)
slide.layouts(report, "report_layout")
report <- addPlot(report, function() print(p))
writeDoc(report, "example_report.pptx")
以这种方式绘制给定的图表:
p <- plot_ly(agregado_cedex(), labels = ~Escalado, values = ~Total,type = "pie",
text = ~Total, width = 500, height = 250, hoverinfo = "none") %>% config(displayModeBar = FALSE) %>%
layout(title = "Desglose incidencias", showlegend = TRUE,
xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE))
此图表没有问题,因为它正确显示在闪亮的应用程序(仪表板)上。
在执行上面的代码时,我在 R Studio 上遇到了下一个错误:
Warning: Error in .jcall: javax.xml.bind.UnmarshalException
- with linked exception:
[org.xml.sax.SAXParseException: The markup in the document preceding the root element must be well-formed.]
我发现了一个类似的帖子,但到目前为止还没有解决Add plots in PPTx without crashing R using addplot()
有谁知道怎么回事?提前致谢!
【问题讨论】:
标签: r powerpoint plotly reporters