8

Using an "execute R script module" in Azure-ml studio, when I plot to an rgl device, I get a broken image icon under the graphics section of the R Device output.

Is there some way to view (and even interact with) the resulting rgl device? If not is there some way to transfer the rgl output to a standard R graphics device?

Simple example:

# put this code inside the execute R script module
library(rgl)
rgl.spheres(0,0,0, radius=1, col="red")

To be clear, I know about rgl.snapshot and rgl.postscript and how to save and /or view an rgl device in a standard R session, but have not been able to make these standard approaches work in azure-ml.

Dan Ciborowski - MSFT
  • 6,807
  • 10
  • 53
  • 88
Jota
  • 17,281
  • 7
  • 63
  • 93

1 Answers1

1

As of today openGL graphics are not supported on Azure Machine Learning. The rgl library is based on openGL and therefor not supported. In theory, and this is only in theory, if a package were built on webGL instead, it "should" render in the graphics window as long as you are viewing from a modern browser. That said, I do not see any webgl based r packages, only opengl to webgl conversion packages, which outputs a file.

David Crook
  • 2,722
  • 3
  • 23
  • 49
  • however it requires you to use the webgl rendering which builds a dynamic .html page which would need to be rendered after words. That resulting html file would be able to be viewed in theory. What happens in those wrappers is that the open gl is converted and then produces the resulting webgl page you speak of. – David Crook Mar 02 '16 at 20:00
  • No, there doesn't need to be any OpenGL created at all. Just specify that you want to use the NULL device, and ask for WebGL output by calling the rglwidget() function from the rglwidget package. If you're running in RStudio, it will display in the viewer pane. I've never used Azure Machine Learning, so I don't know if it has anything equivalent. – user2554330 Mar 02 '16 at 21:18
  • 1
    got a sample? I ran the askers code in RStudio as well as AML, then looked up the package in CRAN where it said it has a dependency on opengl. I think a fair test would be to see if a batch execution machine can generate the output. Because rgl is interactive, I am under the impression that it generates the opengl code, and then displays in that pane, and if wanting to do the webgl conversion, it generates a new file per the documentation. I am of course open to finding out I'm totally wrong given a sample, I'll run it on one of my batch servers, if it works, I would be super excited. :) – David Crook Mar 03 '16 at 17:08
  • https://cran.r-project.org/web/packages/rgl/index.html - See system requirements, it takes a dependency on openGL – David Crook Mar 03 '16 at 17:16
  • To compile it you'd need OpenGL, and that probably means the host machine needs the library there to allow it to load. But it can run entirely without using OpenGL. I'm assuming that the linking and loading are working for the OP because they'd get a very different error if they didn't. – user2554330 Mar 03 '16 at 20:24
  • (Continued...) But if the environment variable RGL_USE_NULL is set to "yes" (without the quotes), it should never actually call any OpenGL functions. To see what happens, set the variable, then do a plot (e.g. "example(plot3d)", and follow that with a call to rglwidget::rglwidget(). In RStudio, that will display the results in the viewer pane. In plain old Rterm, it will write them to a tempfile, and open that in a browser. – user2554330 Mar 03 '16 at 20:33