getting an error while trying to knit using "ggplotly" in word.

Is it possible to do "ggplotly" in word? I am trying to knit in markdown but I am getting an error.

"Version:1.0 StartHTML:0000000107 EndHTML:0000001465 StartFragment:0000000127 EndFragment:0000001447

Error: Functions that produce HTML output found in document targeting docx output. Please change the output type of this document to HTML. Alternatively, you can allow HTML output in non-HTML formats by adding this option to the YAML front-matter of your rmarkdown file: always_allow_html: yes Note however that the HTML output will not be visible in non-HTML formats. Execution halted"

Hi @rahul67,

No, you cannot embed the HTML figure in a Word document. An interactive plotly plot is HTML, and so it works fine with HTML output R Markdown files, but it won't work when rendering to Word or PDF format outputs. You can either consider changing the output format to HTML, or include a static figure instead of the plotly object. I think by default knitr will take a snapshot of the figure and embed the static version, but not entirely sure if this will happen for plotly figures (and you may also need webshot or another tool to allow this to work).

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.