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")
```
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!