TkRplot {tkrplot}R Documentation

Tk Rplot

Description

Placing R graphics in a Tk image.

Usage

tkrplot(parent, fun)
tkrreplot(lab, fun = lab$fun)
tkpersp(...)

Arguments

parent parent of widget window
fun function of no arguments that creates the plot
lab a Tk Rplot label widget

Details

The function tkrplot creates and returns a Tk label widget containing a Tk image of type Rplot. For now the size is hard-wired. The plot is created by calling fun with a special device used create the image.

The function tkrreplot calls fun to place a new plot in the Rplot widget lab.

tkpersp is called like persp but produces a plot in which some of the parameters of persp are controlled graphically.

Examples


## These cannot be run by examples() but should be OK when pasted
## into an interactive R session with the tcltk package loaded

tt <- tktoplevel()
bb<-1
img <-tkrplot(tt, function() plot(1:20,(1:20)^bb))
f<-function(...) {
    b <- as.numeric(tclvar$bb)
    if (b != bb) {
        bb <<- b
        tkrreplot(img)
    }
}
s <- tkscale(tt, command=f, from=0.05, to=2.00, variable="bb",
             showvalue=F, resolution=0.05, orient="horiz")
tkpack(img,s)