Help: Can't plot anything using Plotly

Hi Community,
A few days ago I built a dashboard (using flexdashboard) to show some plotly graphs and it worked perfectly fine. But today when I run the dashboard all the graphs are blank.

Triying some plots in the console I figured out that the problem is with plotly as it works well using ggplot2 and R Base graphics, but when I try to plot something simple using plotly:

library(ggplot2)
library(plotly)

plot_ly(x = ~rnorm(50), type = "histogram")

It gives me a blank panel:

And sometimes, for example with this:

library(ggplot2)
library(plotly)

plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length)

It shows this error:

No trace type specified:
  Based on info supplied, a 'scatter' trace seems appropriate.
  Read more about this trace type -> https://plot.ly/r/reference/#scatter
No scatter mode specifed:
  Setting the mode to markers
  Read more about this attribute -> https://plot.ly/r/reference/#scatter-mode

I don't know what the problem is, does somebody know?

(Also I have RStudio updated to the latest version (R version 3.6.3 (2020-02-29)) and all the packages as well)

It's possible this is happening because you're using software rendering, which does not support certain Viewer pane artefacts (e.g. plotly plots).

You can generate a GPU diagnostics report at Help -> Diagnostics -> Show GPU Diagnostics. Does it show hardware acceleration is enabled?

See also: https://support.rstudio.com/hc/en-us/articles/360017886674-Troubleshooting-RStudio-Rendering-Errors

@TomasG: Several of my students had similar issues, so I posted an issue on plotly's github site, but haven't heard back.

I run the same codes in a Windows computer at my workplace and it worked well, so I think it's something with the configuration

It might have to do with which versions of R and plotly are installed. I don't think there was an issue before, so an update might have caused it -- does sessionInfo() show you have the same set up on your computer and on the workplace computer you used?

@kevinushey I tried what you told me but I think there's something wrong with my RStudio configuration.
I couldn't find any GPU diagnostics or the advanced tab at the global option.
This is how my RStudio looks:


And this is how the RStudio at my workplace looks:

Do you know why is that?

@dromano Is the same R version.
My computer says:

R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

While my workplace computer says:

R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

But, as I answered to the other comment, it seems there's something wrong with my RStudio configuration

This doesn't show the version of the packages, so it might be worth checking those, too, although it could be the Windows version difference, too? Did you confirm package info with sessionInfo(), too?

@dromano Well I got the latest version of plotly (4.9.2).
Although, according to sessionInfo(), I have Windows >= 8 x64 (build 9200) I actually have W10 (build 18362.657) as OS.
Could that be the problem?

I'm not sure, but the problem is so prevalent with my students who use Windows that I was suspecting version conflicts. Are you using ggplot2 and ggplotly(), or are using plotly directly? And what are you version numbers for those on both machines?

@dromano I got no problem using ggplot2 and I have the latest version (3.2.1) of ggplot2 on both machines.

I just reinstall RStudio and now I can run plots using plotly without problems:

Great! And I'm curious: Does your sessionInfo() output show the right OS now?

@dromano Yes, now it shows:

R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Which is right. So, I suppose there was something wrong in the installation after all.

That' s helpful to know -- I'll have to have my students do the same! Thanks for checking, @TomasG

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