Skip to content

(regression) plotly.R v4.12.0 no longer renders any figures in knitr/LaTeX #2480

@JElchison

Description

@JElchison

Hi folks, THANKS for a great library!

plotly.R v4.12.0 seems to have introduced a new regression: Using knitr (LaTeX), all rendered Plotly figures are now empty -- both inside the final compiled PDF, and inside each figure's individual PDF (in /figure/)

The workaround is reverting to v4.11.0

Min working example (test.Rnw):

\documentclass{article}

\begin{document}

<<include=FALSE>>=
library(knitr)
library(remotes)
#remotes::install_version("plotly", version = "4.11.0")  # works
remotes::install_version("plotly", version = "4.12.0")  # leaves empty figure
@

<<label=version, echo=FALSE, fig.keep='last', out.width="5in", crop=TRUE>>=
packageVersion("plotly")
@

Top line -- Figure should be below

<<label=Sepal, echo=FALSE, fig.keep='last', out.width="5in", crop=TRUE>>=
plotly::plot_ly(
  data = iris,
  x = ~Sepal.Length,
  y = ~Sepal.Width,
  type = 'scatter',
  mode = 'markers',
  color = ~Species,
  marker = list(size = 10, opacity = 0.8)
)
@

Bottom line -- Figure should be above

\end{document}

To render, simple save the above snippet as a new file test.Rnw, and click the "Compile PDF" button in RStudio.

Note the absence of figures when using 4.12.0, both:

  • in final-compiled PDF (here, test.pdf)
  • in each figure's individual PDF (here, /figure/Sepal-1.pdf)
Image

Note that reverting to 4.11.0 allows figures to render properly:

Image

Thanks for reading!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions