Learn R Programming

ursa (version 3.11.1)

compose_close: Finish plotting

Description

Function compose_close does followed tasks: 1) completes all unfinsished actions before shutting down graphical device, 2) cuts extra margins, and 3) opens resulted PNG file in the associated viewer.

Usage

compose_close(...)

## non-public .compose_close(kind = c("crop2", "crop", "nocrop"), border = 5, bpp = 0, execute = TRUE, verbose = FALSE)

Value

Function returns NULL value.

Arguments

...

Set of arguments, which are recognized via their names and classes, and then passed to .compose_close:

Pattern (compose_close)Argument (.compose_close)
(^$|crop|kind)kind
(border|frame)border
bppbpp
(render|execute|view|open)execute
verb(ose)*verbose

kind

Character keyword for cutting of excess white spaces. If kind="nocrop" then there is no cut. If kind="crop" then only outer margins are cutted. If kind="crop2" then all outer margins and inner white spaces (e.g., between color bar panel and text caption) are cutted.

border

Non-negative integer. Number of pixels for margins, which are not cropped. Default is 5L.

bpp

Integer. Bits per pixel for output PNG file. Valid values are 0L, 8L, 24L. If bpp=0L, then 8 bpp is used for "windows" type of PNG device, and 24 bpp is used for "cairo" type of PNG device. The type of device is specified in compose_open function.

execute

Logical. Should created PNG file be opened in the associated external program for viewing graphical files? Default is TRUE.

verbose

Logical. Value TRUE provides some additional information on console. Default is FALSE.

Author

Nikita Platonov platonov@sevin.ru

Warning

Currenty, execute=TRUE is implemented for Windows platform only using construction R CMD open \emph{fileout}.

Details

The cut manipulations (crop="crop" or crop="crop2") are implemented using readPNG and writePNG functions of package png. These fuctions have limitations in the memory allocation.

Function compose_close clears all internal graphical options, specified during compose_open executing.

Some parameters are specified in compose_open: weather output PNG file will be removed after opening (logical delafter), or what is the time of waiting for file opening and next removing (numerical wait in seconds).

Examples

Run this code
session_grid(NULL)
a <- ursa_dummy(nband=6,min=0,max=255,mul=1/4)

## exam 1
compose_open()
compose_close()

## exam 2
compose_open(a)
compose_close()

## exam 3
compose_open("rgb",fileout="tmp1")
compose_plot(a[1:3])
compose_close(execute=FALSE)
Sys.sleep(1)
a <- dir(pattern="tmp1.png")
print(a)
file.remove(a)

Run the code above in your browser using DataLab