Learn R Programming

export (version 0.3.0)

rgl2bitmap: Save currently active rgl 3D graph to bitmap format

Description

Save currently active rgl 3D graph to bitmap format in current orientation

Usage

rgl2bitmap(file = "Rplot", type = c("PNG"))

rgl2png(...)

Value

No return value

Arguments

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 PNG is supported.

...

passing the rgl2png arguments to rgl2bitmap

Functions

  • rgl2png(): Save currently active rgl 3D graph to PNG format

Author

Tom Wenseleers

Examples

Run this code
# 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

Run the code above in your browser using DataLab