pander icon indicating copy to clipboard operation
pander copied to clipboard

Add support for plotly objects, and possibly htmlwidget objects?

Open happyshows opened this issue 7 years ago • 6 comments

Error in x[[i]] : subscript out of bounds In addition: Warning message: In pander.default(x$result) : No pander.method for "plotly", reverting to default.No pander.method for "htmlwidget", reverting to default.

happyshows avatar Sep 15 '16 03:09 happyshows

Thanks for this report. Can you please provide some details on the use case? I mean why do you run a plotly object through pander? Or are you using Pandoc.brew?

daroczig avatar Sep 28 '16 10:09 daroczig

Hi,

I was attempting to use pander to dynamically create markdown files that allow me to embed plotly visualization in there, so that reader will have some flexibility in the generated html file to do filtering, regrouping.

happyshows avatar Sep 28 '16 16:09 happyshows

Thanks a lot, makes a lot of sense, will try to get some time to add support for it soon.

daroczig avatar Sep 29 '16 11:09 daroczig

Any news or workarounds on this? I love using pander to dynamically create documents with static ggplot figures and it would be awesome to be able to do the same with plotly. I'm using R 4.0.3 and pander 0.6.3 and I still get the same error reported by the host. Here's the code I'm using:

evalsOptions("width", 900)
evalsOptions("height", 600)
myReport <- Pandoc$new(title="Plots")

for (name in names(plots)) {
  myReport$add.paragraph(paste0("## ", name))
  myReport$add(plots[[name]])
}

myReport$add.paragraph("") # hack, otherwise there is a figure in the TOC

myReport

timwoelfle avatar Mar 29 '21 14:03 timwoelfle

Sorry for not making this happen sooner. @timwoelfle, can you please edit your above example to make it reproducible? Eg creating the list of plots. Please feel free to keep it to a super simple minimal example.

daroczig avatar Mar 30 '21 11:03 daroczig

Attached is a reproducible example! The ggplot objects work, but the plotly objects don't. You have to run the notebook in RStudio (e.g. with "Run all") and save it as a notebook, looking at the auto-generated test.nb.html (also attached, knitting won't work).

timwoelfle avatar Apr 04 '21 07:04 timwoelfle