Greyed out and non-interactive preview plot in Rstudio r-markdown and plotly

Yesterday I updated RStudio and R, and since then most of my markdowns cannot show interactive plots of plotly anymore. Instead I get a greyed out plot (which shows the correct plot, but it is grey and non interactive).

The same markdown works still perfectly on my other PC with the old R and RStudio.
Also if I knit I get "perfect" plots (interactive and not grey).

I figured out that any kind of console output (see "Not Working I") supresses the interaction. Also if I plot multiple plots in the same chunk, it also becomes grey and non-interactive (see "Not Working II"). If I just have one plot and I set it up so that no console message is shown, I still get an interactive plot.

Any idea what the issue could be?

Here is a minimum working example which shows the problem:


---
title: "Untitled"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(plotly)
```  

```{r Not Working I}  
plot_ly(economics, x = ~date, y = ~unemploy / pop)
```

```{r Working I}
plot_ly(economics, x = ~date, y = ~unemploy / pop, 
             type = "scatter", mode="markers")
```

```{r Not Working II}
plot_ly(economics, x = ~date, y = ~unemploy / pop, 
             type = "scatter", mode="markers")

plot_ly(economics, x = ~date, y = ~unemploy / pop, 
             type = "scatter", mode="markers")
```

1 Like

Just wondering - do people who have the latest R and RStudio have the same issue, or is it just my PC/Setup who creates that problem?

There is currently an open issue related to this I believe

Thanks for the bug report - we're looking into this urgently.

This bug has been fixed in the latest Spotted Wakerobin which you can try from the dailies: https://dailies.rstudio.com/. It will also be backported to a patch-release of 2022.02 (date TBD). Please let me know if the daily resolves the problem for you!

The current daily fixed the bug - everything works now!
Thanks a lot for the quick fix.

1 Like

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.