gp.open {TeachingDemos}R Documentation

Alpha version functions to send plotting commands to GnuPlot

Description

These functions allow you to open a connection to a gnuplot process, send data and possibly other information to gnuplot for it to plot, then close gnuplot and clean up temporary files and variables. These functions are alpha level at best, use at your own risk.

Usage

gp.open(where='c:/progra~1/GnuPlot/bin/pgnuplot.exe')
gp.close(pipe=.gp)
gp.send(cmd='replot',pipe=.gp)
gp.plot(x,y,type='p',add=FALSE, title=deparse(substitute(y)),pipe=.gp)

Arguments

where Path to GnuPlot Executable
pipe The pipe object connected to GnuPlot (returned from gp.open), warning: changing this from the default will probably break things
cmd Text string, the command to be sent verbatim to the GnuPlot process
x The x coordinates to plot
y the y coordinates to plot
type Either 'p' or 'l' for plotting points or lines
add Logical, should the data be added to the existing plot or start a new plot
title The title or legend entry

Details

These functions provide a basic interface to the GnuPlot program (you must have GnuPlot installed (separate install)), gp.open runs GnuPlot and establishes a pipe connection, gp.close sends a quite command to gnuplot and cleans up temporary variables and files, gp.send sends a command to the GnuPlot process verbatim, and gp.plot sends data and commands to the process to create a standard scatterplot or line plot.

Value

gp.open returns and invisible copy of the pipe connection object (to pass to other functions, but don't do this because it doesn't work right yet).
The other 3 functions don't return anything meaningful. All functions are run for their side effects.

Note

These functions create some temporary files and 2 temporary global variables (.gp and .gp.tempfiles), running gp.close will clean these up (so use it).

These functions are still alpha level.

Author(s)

Greg Snow greg.snow@intermountainmail.org

References

http://www.gnuplot.info/

See Also

plot

Examples

 ## Not run: 

x <- 1:10
y <- 3-2*x+x*x+rnorm(10)

gp.open()
gp.plot(x,y)
gp.send('replot 3-2*x+x**2')
gp.close()
 ## End(Not run)

[Package TeachingDemos version 1.4 Index]