condGrob: Create a named grob or a template grob depending on a test

Description Usage Arguments Value Examples

Description

Creates and returns a grid object using the function given by 'grobFun' when 'test' is 'TRUE' Otherwise a simple 'grob()' is produced with the same parameters. All grob parameters are given in '...'.

Usage

1
condGrob(test = TRUE, grobFun = grob, name = "grob name", ...)

Arguments

test

Either 'TRUE' or 'FALSE' to indicate whether 'grobFun' is to be used (default 'TRUE') or not.

grobFun

The function to be used to create the grob when 'test = TRUE' (e.g. 'textGrob', 'polygonGrob', etc.).

name

The name to be used for the returned grob.

...

The arguments to be given to the 'grobFun' (or to 'grob()' when 'test = FALSE').

Value

A grob as produced by either the 'grobFun' given or by 'grob()' using the remaining arguments. If 'test = FALSE' then the name is suffixed by ": 'grobFun name' arguments".

Examples

1
2
3
4
5
myGrob <- condGrob(test = (runif(1) > 0.5),
                   grobFun = textGrob,
                   name = "my label",
                   label = "Some random text")
myGrob

loon documentation built on Oct. 30, 2019, 9:42 a.m.