rowBUTTONS: Geometry for the Really Poor Man's GUI

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

View source: R/rowBUTTONS.R

Description

Create a set of buttons and associated geometry for RPMG

Usage

1
rowBUTTONS(labs, col = 6, pch = 4, cex=1, boxsize = -1)

Arguments

labs

Vector of labels for the buttons running across the top and bottom of the plot

col

Optional vector of colors for the buttons

pch

Optional vector of symbols to be plotted in the center of the buttons

cex

optional character expansion for text

boxsize

optional box size for the buttons, default=-1 where the size is adjusted for string size

Details

rowBUTTONS is called after the R graphic has been created so the geometry of the buttons can be set. Subsequent calls to whichbutt use the geometry to determine which button has been selected. Some of the parameters chosen here are controlled by par-like parameters.

Value

The function returns a list of buttons and the associated geometry.

N

Number of Buttons

labs

Names of the Buttons

x1

vector of left x-coordinates for the buttons

x2

vector of right x-coordinates for the buttons

y1

vector of top y-coordinates for the buttons

y2

vector of bottom y-coordinates for the buttons

Note

rowBUTTONS uses the current plotting parameters from par() to set the geometry. If the window is resized, rowBUTTONS should be reset to extract correct button position. In interactive mode this is done each time the plot is refreshed.

Author(s)

Jake Anderson and Jonathan M. Lees<[email protected]>

See Also

whichbutt, par

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#######  create a plot
plot(c(0,1), c(0,1))
#######  set the character vector of button labels
mybutts = c("DONE", "REFRESH", "rainbow", "topo", "terrain", "CONT",
"XSEC","PS" )
#########  set colors and plotting chars for buttons
colabs = rep(1, length=length(mybutts))
pchlabs = rep(0,length(mybutts))
#######  create and set geometry for buttons:
buttons = rowBUTTONS(mybutts, col=colabs, pch=pchlabs)

RPMG documentation built on Jan. 20, 2018, 9:04 a.m.