R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("rgl-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('rgl') > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "bbox" > > ### * bbox > > flush(stderr()); flush(stdout()) RGL: NO WM_DELETE > > ### Name: rgl.bbox > ### Title: setup Bounding Box decoration > ### Aliases: rgl.bbox > ### Keywords: dynamic > > ### ** Examples > > rgl.bbox(color="#333377", emission="#333377", specular="#3333FF", shininess=5, alpha=0.8 ) > > > > cleanEx(); ..nameEx <- "bg" > > ### * bg > > flush(stderr()); flush(stdout()) RGL: Pixmap load: file format unsupported RGL: Pixmap load: failed > > ### Name: rgl.bg > ### Title: setup Background > ### Aliases: rgl.bg > ### Keywords: dynamic > > ### ** Examples > > > # the holo-globe (inspired by star trek): > > rgl.bg(sphere=TRUE, color=c("black","green"), lit=FALSE, back="lines" ) > > # an environmental sphere with a nice texture. > > rgl.bg(sphere=TRUE, texture=system.file("textures/sunsleep.png", package="rgl"), back="filled" ) > > > > cleanEx(); ..nameEx <- "primitive" > > ### * primitive > > flush(stderr()); flush(stdout()) > > ### Name: rgl.primitive > ### Title: add primitive set shape > ### Aliases: rgl.primitive rgl.points rgl.lines rgl.triangles rgl.quads > ### Keywords: dynamic > > ### ** Examples > > rgl.clear() > rgl.points(rnorm(1000), rnorm(1000), rnorm(1000), color=heat.colors(1000), size=2) > > > > cleanEx(); ..nameEx <- "rgl" > > ### * rgl > > flush(stderr()); flush(stdout()) > > ### Name: rgl > ### Title: 3D visualization device system > ### Aliases: rgl rgl.open rgl.close rgl.cur rgl.set rgl.quit > ### Keywords: dynamic > > ### ** Examples > > example(rgl.surface) rgl.sr> data(volcano) rgl.sr> y <- 2 * volcano rgl.sr> x <- 10 * (1:nrow(y)) rgl.sr> z <- 10 * (1:ncol(y)) rgl.sr> ylim <- range(y) rgl.sr> ylen <- ylim[2] - ylim[1] + 1 rgl.sr> colorlut <- terrain.colors(ylen) rgl.sr> col <- colorlut[y - ylim[1] + 1] rgl.sr> rgl.clear() rgl.sr> rgl.surface(x, z, y, color = col) > > > > cleanEx(); ..nameEx <- "snapshot" > > ### * snapshot > > flush(stderr()); flush(stdout()) > > ### Name: rgl.snapshot > ### Title: export screenshot > ### Aliases: rgl.snapshot > ### Keywords: dynamic > > ### ** Examples > > > ## Not run: > ##D > ##D # > ##D # create animation > ##D # > ##D > ##D for (i in 1:45) { > ##D rgl.viewpoint(i,20) > ##D print( paste("pic",formatC(i,digits=1,flag="0"),".png",sep="") ) > ##D rgl.snapshot(filename) > ##D } > ##D > ## End(Not run) > > > > > cleanEx(); ..nameEx <- "spheres" > > ### * spheres > > flush(stderr()); flush(stdout()) > > ### Name: rgl.spheres > ### Title: add sphere set shape > ### Aliases: rgl.spheres > ### Keywords: dynamic > > ### ** Examples > > rgl.spheres(rnorm(10), rnorm(10), rnorm(10), radius=.2, color=rainbow(10)) > > > > cleanEx(); ..nameEx <- "sprites" > > ### * sprites > > flush(stderr()); flush(stdout()) RGL: Pixmap load: file format unsupported RGL: Pixmap load: failed > > ### Name: rgl.sprites > ### Title: add sprite set shape > ### Aliases: rgl.sprites > ### Keywords: dynamic > > ### ** Examples > > rgl.sprites(rnorm(500), rnorm(500), rnorm(500), color=rainbow(100), lit=FALSE, + textype="alpha", texture=system.file("textures/particle.png", package="rgl"), + alpha=.2) > > > > cleanEx(); ..nameEx <- "surface" > > ### * surface > > flush(stderr()); flush(stdout()) > > ### Name: rgl.surface > ### Title: add height-field surface shape > ### Aliases: rgl.surface > ### Keywords: dynamic > > ### ** Examples > > > # > # volcano example taken from "persp" > # > > data(volcano) > > y <- 2 * volcano # Exaggerate the relief > > x <- 10 * (1:nrow(y)) # 10 meter spacing (S to N) > z <- 10 * (1:ncol(y)) # 10 meter spacing (E to W) > > ylim <- range(y) > ylen <- ylim[2] - ylim[1] + 1 > > colorlut <- terrain.colors(ylen) # height color lookup table > > col <- colorlut[ y-ylim[1]+1 ] # assign colors to heights for each point > > rgl.clear() > rgl.surface(x, z, y, color=col) > > > > > cleanEx(); ..nameEx <- "texts" > > ### * texts > > flush(stderr()); flush(stdout()) > > ### Name: rgl.texts > ### Title: add text set shape > ### Aliases: rgl.texts > ### Keywords: dynamic > > ### ** Examples > > rgl.texts(rnorm(10)*100,rnorm(10)*100,rnorm(10)*100,text=1:10,justify="center", color=heat.colors(10)) > > > > cleanEx(); ..nameEx <- "viewpoint" > > ### * viewpoint > > flush(stderr()); flush(stdout()) > > ### Name: rgl.viewpoint > ### Title: setup viewpoint > ### Aliases: rgl.viewpoint > ### Keywords: dynamic > > ### ** Examples > > > # animated round trip tour > > for(i in 1:360) { + rgl.viewpoint(i,i/4); + } > > > > > ### *