rp.tkrplot | R Documentation |
These functions call Luke Tierney's tkrplot
and tkrreplot
functions from the tkrplot package to allow R graphics to be displayed in a panel.
rp.tkrplot(panel, name, plotfun, action=NA, mousedrag=NA, mouseup=NA, hscale=1, vscale=1, pos=NULL, foreground=NULL, background=NULL, margins=c(0, 0, 0, 0), parentname=deparse(substitute(panel)), mar= par()$mar, ...) rp.tkrreplot(panel, name)
panel |
the panel in which the plot should appear. This may be passed as a panelname string or the panel object itself. |
name |
the name of the plot. This is subsequently used in tkrreplot to specify the plot to be redrawn. |
plotfun |
the function used to create the plot. |
action |
the function called when the plot is clicked. |
mousedrag |
the function called when the mouse is dragged. |
mouseup |
the function called when the mouse is released. |
hscale |
horizontal scaling factor to control the width of the plot. |
vscale |
vertical scaling factor to control the height of the plot. |
pos |
the layout instructions. Please see the |
background |
the colour used for the background of the plot. |
foreground |
the filename of a transparent gif file. This will be overlaid on the tkrplot image after plotting takes place. |
margins |
an integer vector of length 4 giving the margin sizes, in pixels and in the usual order, for the placing of the foreground image. |
parentname |
this specifies the widget inside which the plot should appear. In the current version of rpanel, it should not normally be used. |
mar |
mar parameter for specifying the margins. |
... |
... |
The function action
should take one argument, which should be the panel
to which the tkrplot is attached.
See rp.grid
for details of the grid layout system.
If the argument panel
is set to the panelname string, the same string is returned. If the panel object is used, the altered panel is assigned to both the calling level and panel's environment level.
The action
function should return the panel. Without this assignment any widgets added or alterations made to panel parameters within the action
function will be lost.
rpanel: Simple interactive controls for R functions using the tcltk package. Journal of Statistical Software, 17, issue 9.
rp.image
## Not run: draw <- function(panel) { plot(1:20, (1:20)^panel$h) panel } redraw <- function(panel) { rp.tkrreplot(panel, tkrp) panel } rpplot <- rp.control(title = "Demonstration of rp.tkrplot", h = 1) rp.tkrplot(rpplot, tkrp, draw) rp.slider(rpplot, h, action = redraw, from = 0.05, to = 2.00, resolution = 0.05) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.