figure {RGrace}R Documentation

Plotting window.

Description

figure() opens new GUI window with plotting area (graphic device). figure.back and .GTK.interface are back-end and front-end procedures implementing RGrace functionality. .z.interface is another (primitive) realization of front-end function for RGrace.

Usage

figure.back(width=640,height=480,cells=10)
figure(width=400, height=400, cells=10)
.GTK2.interface(width=400,height=400,cells=10)
.z.interface(width=1000,height=2000,cells=10)

Arguments

width, height initial geometry of plotting area in pixels. Later it may be changed with window manager's resize operations.
cells plotting area are divided by cell x cell grid. Panels inside figure are located in this grid's knots. So setting this parameter for higher values allows finer control of axes' placement.

Details

figure.back is a "abstract class" (or backend) where core functionality of RGrace is implemented. .GTK.interface is a GTK frontend to RGrace. figure function is initially (at package loading) set to .GTK.interface. RGrace design allows users easily implement their own frontend (for example with tcltk GUI and x11 graphic device) and have all functionality of RGrace in the same time. .z.interface is a "dummy" interface which simply uses currently available graphic device as a plot area for RGrace. It is mainly intended for usage with non-interactive devices (like postscript, pdf etc.) when printing of gtkDevice's content is not applicable (for example, in the process of generating Sweave documents with RGrace graphic). Sample Sweave file with RGrace graphic can be found here system.file("scripts","RGrace.Rnw",package="RGrace"). For an example of typical interface class look into Examples section.

figure() and friends has side effects of setting global variable current.Figure to figure()'s return value and setting current graphic device to this window plotting area.

Value

An R-environment of class "figure" with following fields and methods:

panel() method for adding new panels(axes) to figure or accessing specific panel inside figure (see panel).

. For a list of other methods and fields - do ls(current.Figure)

Author(s)

M.Kondrin

See Also

panel

set

get

Examples

#do not run
    .XXX.interface<-function(...){
    #create new device
    x11()
    #fig is local variable pointing to figure back-end
    fig <- figure.back(width=width,height=height,cells=cells)
    #Callback functions you have to define to let figure backend signal your
    #apllication when properties of panel,annotation or element has been
    #changed (to reflect them in GUI controls for example)
    fig$PANEL.CB <- panel.GUI
    fig$ANNOTATION.CB <- annotation.GUI
    fig$ELEMENT.CB <- element.GUI
    #and other code specific to this application
    ......
    }
    
    #then redefine figure() function
    figure<-.XXX.interface
  

[Package RGrace version 0.6-6 Index]