Skip to content

Maximum number of plotly plots in Rmarkdown #188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
CarolineXGao opened this issue Apr 6, 2020 · 3 comments
Closed

Maximum number of plotly plots in Rmarkdown #188

CarolineXGao opened this issue Apr 6, 2020 · 3 comments

Comments

@CarolineXGao
Copy link

It seems that we cannot include more than 15 plotly 3D plots in a Rmarkdown file. Here is the test code :


title: "test"
output: html_document

knitr::opts_chunk$set(echo = TRUE)
plot<-list() 
data<-list()

x <- 1:5/10
y <- 1:5

library(plotly)
for (i in 1:20){
      z <- x %o% y
      z <- z + .2*z*runif(25) - .1*z
      data[[i]]= z 
      plot[[i]]<-plot_ly(x=x,y=y,z=data[[i]], type="surface")
}

htmltools::tagList(plot)

Thanks!!!!!

Best,
Caroline

@alexcjohnson
Copy link
Collaborator

Yes, that's true. It's a browser limitation in fact, that generally you cannot create more than 16 WebGL contexts in one tab. And some of our trace types use 2 or 3 separate contexts for a single graph, so the limit would be dropped down to 8 or 5 charts. See plotly/plotly.js#2333 for more info, one potential work-around (removing off-screen graphs) and one potential long-term solution (multi-regl). This solution isn't part of our existing roadmap unless someone is interested in sponsoring it.

I believe multiple graphs within one plot do share contexts, so you could try using subplots.

@CarolineXGao
Copy link
Author

Thanks very much.

Unfortunately, I have more than 16 contexts. Using subplots didn't really help. I guess this will become more and more of an issue when people started to embed more complicated plotly plots in their Rmarkdown files. Will be looking forward to future resolutions.

Best,

Caroline

@rpkyle rpkyle closed this as completed Apr 9, 2020
@sebidelamata
Copy link

Any follow up on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants