snap: Take a snapshot of the current 3D plot

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/snap.R

Description

snap is designed as a more convenient interface to rgl.snapshot, allowing one to set a base filename for graphic output files, an initial sequence number, and then just use

snap()

to capture the current screen image to a sequentially numbered output file.

Usage

1
snap(suffix = "", fn = .snap.fn, n = .snap.n, inc = TRUE, fmt = "png")

Arguments

suffix

Character string appended to paste(fn, n), for use in naming a related collection of figures (without incrementing n.

fn

Base file name, typically set by assigning a character string to .snap.fn in the global environment.

n

Initial suffix number used to construct the file name, typically set by assigning a character string to .snap.n in the global environment.

inc

Should the function increment the sequential number in the global environment?

fmt

Output graphic file format. Default: png

Details

Output files are written to the current directory. Use setwd to put them where you want.

Value

Returns invisibly the name of the snapshot file

Author(s)

Georges Monette

See Also

rgl.snapshot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
.snap.fn <- 'Lecture1'
.snap.n <- '001'

# ... generate an rgl graph ...
snap()
# ... will invoke rgl.snapshot which filename 'Lecture1001.png' and increment
# .snap.n to '002' in the .GlobalEnv

# ... generate an rgl graph ...
snap()
# ... will invoke rgl.snapshot which filename 'Lecture1002.png' and increment
# .snap.n to '003' in the .GlobalEnv

## End(Not run)

p3d documentation built on May 2, 2019, 5:25 p.m.