rgl2bitmap | R Documentation |
Save currently active rgl 3D graph to bitmap format in current orientation
rgl2bitmap(file = "Rplot", type = c("PNG"))
rgl2png(...)
file |
name of output file. Any extension is ignored and added according to the requested output type. If file already exists it is overwritten. |
type |
desired output type - currently only |
... |
passing the |
No return value
rgl2png()
: Save currently active rgl 3D graph to PNG format
Tom Wenseleers
# Create a file name
filen <- tempfile(pattern = "rgl") # or
# filen <- paste("YOUR_DIR/rgl")
# Generate a 3D plot using 'rgl'
x = y = seq(-10, 10, length = 20)
z = outer(x, y, function(x, y) x^2 + y^2)
rgl::persp3d(x, y, z, col = 'lightblue')
# Save the plot as a png
rgl2png(file = filen)
# Note that omitting 'file' will save in current directory
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.