acorg / Racmacs

Racmacs R package for performing antigenic cartography
https://acorg.github.io/Racmacs/
GNU Affero General Public License v3.0
20 stars 9 forks source link

view(map) does not generate image in R studio #41

Closed rpresler closed 3 years ago

rpresler commented 3 years ago

R studio 1.3.1093 (Win10) R 4.0.3

plot(map) gives a fine image in R studio view(map) fails to render image of map in R studio view(map) successfully gives image in web browser, but only when using R command-line

shwilks commented 3 years ago

Thanks for the issue report, when you run view(map) in Rstudio do you just get a blank white image or nothing at all? If you right click on the Rstudio viewer and do inspect element, do you get any errors popping up in the javascript console? and if you click the show in new window options on the rstudio viewer to open things up in the web browser does it then work again, similar to from the command line? It sounds like it's a specific incompatibility with the browser Rstudio uses for the viewer I guess?

rpresler commented 3 years ago

when you run view(map) in Rstudio do you just get a blank white image or nothing at all? Just a blank white area in R studio.

do inspect element, do you get any errors popping up in the javascript console? Yes I do! Here's what I copy-pasted from the "DevTools" Console tab. Added some line breaks to keep the error msgs organized:

three.min.js:202 THREE.WebGLRenderer: Error creating WebGL context. mg @ three.min.js:202

three.min.js:202 Uncaught Error: Error creating WebGL context. at new mg (three.min.js:202) at new Renderer (renderer.js:7) at RacViewer.initiate (init.js:50) at new R3JSviewer (init.js:33) at new RacApp (init.js:9) at new RacViewer (init.js:24) at Object.factory (RacViewer.js:11) at Object.initialize (htmlwidgets.js:883) at htmlwidgets.js:585 at Array.forEach ()

three.min.js:202 THREE.WebGLRenderer: Error creating WebGL context. mg @ three.min.js:202

three.min.js:202 Uncaught Error: Error creating WebGL context. at new mg (three.min.js:202) at new Renderer (renderer.js:7) at RacViewer.initiate (init.js:50) at new R3JSviewer (init.js:33) at new RacApp (init.js:9) at new RacViewer (init.js:24) at Object.factory (RacViewer.js:11) at Object.initialize (htmlwidgets.js:883) at htmlwidgets.js:585 at Array.forEach ()

if you click the show in new window options on the rstudio viewer to open things up in the web browser does it then work again, similar to from the command line?

No, it opens a new R studio window that is also just blank and white.

It sounds like it's a specific incompatibility with the browser Rstudio uses for the viewer I guess? Hm, I'm not an expert at R or R studio, but it sounds like a consistent hypothesis to me. I hope the error messages help point the way.

Let me know if I can help any other way. Thanks for being so prompt!

Best regards, -Rob


From: shwilks notifications@github.com Sent: Tuesday, February 23, 2021 2:32 AM To: acorg/Racmacs Racmacs@noreply.github.com Cc: Rob Presler robert.presler@wisc.edu; Author author@noreply.github.com Subject: Re: [acorg/Racmacs] view(map) does not generate image in R studio (#41)

Thanks for the issue report, when you run view(map) in Rstudio do you just get a blank white image or nothing at all? If you right click on the Rstudio viewer and do inspect element, do you get any errors popping up in the javascript console? and if you click the show in new window options on the rstudio viewer to open things up in the web browser does it then work again, similar to from the command line? It sounds like it's a specific incompatibility with the browser Rstudio uses for the viewer I guess?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/acorg/Racmacs/issues/41#issuecomment-784003502, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ASBBNIV533P55ZWUOJR52YTTANR2FANCNFSM4YBII6WA.

shwilks commented 3 years ago

Thanks Rob, that's really helpful, so yeah it seems like it's a problem with the particular browser RStudio uses, which is somehow not quite the same as the standard web browsers somehow, this sort of difference has occasionally popped up before but only in minor things like different defaults it uses text font styles and things like that.

It's a bit tricky to debug without being able to reproduce the problem but I'm working on getting a windows installation I can test stuff like this on. Do you happen to know if this is a general RStudio in Windows problem or more specific for your installation? Since it seems to be RStudio browser specific I guess it might be worth updating to the latest windows version and seeing if that makes any difference? One thing I can try my end is updating the threejs library it uses to the latest version, but I worry the problem might be more fundamental like the RStudio windows browser does not support WebGL for 3D rendering..

As a side note, on the mac at least there is an option for opening up a new Rstudio viewer window, but also a separate option for opening the viewer up in a webpage. If indeed there is something like that, that might be a slightly less annoying work around for now than having to run it from the command line.

shwilks commented 3 years ago

hmm, according to this discussion, which seems like it may be somewhat related because I think the issue is with establishing a webgl rendering context, there are some settings you can fiddle with, and perhaps indeed there is some issue that has been fixed in later RStudio versions?

https://community.rstudio.com/t/webgl-is-not-supported-by-your-browser-plotly/13962

shwilks commented 3 years ago

and this looks like it may be exactly the same sort of issue..

https://github.com/rstudio/rstudio/issues/5678

rpresler commented 3 years ago

Thanks! The problem is confirmed to be Rstudio and how it handles the rendering

When I switch the rendering from "auto-detect" and force it to use "Desktop OpenGL" I can suddenly view the rendered maps, but then I simultaneously lost all of the visible R code (i.e. switching the settings basically inverted what I could see -- all view(map) instances are visible, but now the text/code is missing/invisible)

Since it sounds like a local problem, I'll try working with David and our IT department to find a fix.

Thanks so much for your help, I'm glad it looks to be a "me" problem and not a Racmacs problem 🙂

Warm regards,

-Rob


From: shwilks notifications@github.com Sent: Thursday, February 25, 2021 2:48 PM To: acorg/Racmacs Racmacs@noreply.github.com Cc: Rob Presler robert.presler@wisc.edu; Author author@noreply.github.com Subject: Re: [acorg/Racmacs] view(map) does not generate image in R studio (#41)

and this looks like it may be exactly the same sort of issue..

rstudio/rstudio#5678https://github.com/rstudio/rstudio/issues/5678

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/acorg/Racmacs/issues/41#issuecomment-786193424, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ASBBNITTRUFI7CENJCGWYHTTA2ZTHANCNFSM4YBII6WA.

shwilks commented 3 years ago

No problem! I'll leave this issue open in case you come across any solutions you want to post here, it'd be great to know if you find anything to fix it, certainly having to choose between seeing the viewer or your code seems er sub-optimal.. :D

davipatti commented 3 years ago

FYI I just tried this on windows 10 and view works ok

Rstudio 1.4.1103 R 4.0.3

rpresler commented 3 years ago

After working with our IT department, it looks like everything is back in business. I can now select the "Desktop OpenGL" option and see both the "view" elements and the text/code simultaneously.

Thanks all, best wishes,

-Rob


From: David Pattinson notifications@github.com Sent: Monday, March 1, 2021 8:45 AM To: acorg/Racmacs Racmacs@noreply.github.com Cc: Rob Presler robert.presler@wisc.edu; Author author@noreply.github.com Subject: Re: [acorg/Racmacs] view(map) does not generate image in R studio (#41)

FYI I just tried this on windows 10 and view works ok

Rstudio 1.4.1103 R 4.0.3

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/acorg/Racmacs/issues/41#issuecomment-788002318, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ASBBNIXWDY5H5EMDVGPAF3LTBOR7FANCNFSM4YBII6WA.

davipatti commented 3 years ago

That's great rob. I'll close this issue