Usage
labcurve(curves, labels=names(curves),
method=NULL, keys=NULL, keyloc=c("auto","none"),
type="l", step.type=c("left", "right"),
xmethod=if(any(type=="s")) "unique" else "grid",
offset=NULL, xlim=NULL,
tilt=FALSE, window=NULL, npts=100, cex=NULL,
adj="auto", angle.adj.auto=30,
lty=pr$lty, lwd=pr$lwd, col.=pr$col, transparent=TRUE,
arrow.factor=1, point.inc=NULL, opts=NULL, key.opts=NULL,
empty.method=c('area','maxdim'), numbins=25,
pl=!missing(add), add=FALSE,
ylim=NULL, xlab="", ylab="",
whichLabel=1:length(curves),
grid=FALSE, xrestrict=NULL, ...)putKey(z, labels, type, pch, lty, lwd,
cex=par('cex'), col=rep(par('col'),nc),
transparent=TRUE, plot=TRUE, key.opts=NULL, grid=FALSE)
putKeyEmpty(x, y, labels, type=NULL,
pch=NULL, lty=NULL, lwd=NULL,
cex=par('cex'), col=rep(par('col'),nc),
transparent=TRUE, plot=TRUE, key.opts=NULL,
empty.method=c('area','maxdim'),
numbins=25,
xlim=pr$usr[1:2], ylim=pr$usr[3:4], grid=FALSE)
drawPlot(..., xlim=c(0,1), ylim=c(0,1), xlab='', ylab='',
ticks=c('none','x','y','xy'),
key=FALSE, opts=NULL)
# Points(label=' ', type=c('p','r'),
# n, pch=pch.to.use[1], cex=par('cex'),
# rug = c('none','x','y','xy'), ymean)
# Curve(label=' ',
# type=c('bezier','polygon','linear','pol','step','gauss'),
# n=NULL, lty=1, lwd=par('lwd'), degree=2,
# evaluation=100, ask=FALSE)
# Abline(...)
## S3 method for class 'drawPlot':
plot(x, file, xlab, ylab, ticks,
key=x$key, keyloc=x$keyloc, \dots)
largest.empty(x, y, width, height,
numbins=25, method=c('area','maxdim'),
xlim=pr$usr[1:2], ylim=pr$usr[3:4],
pl=FALSE, grid=FALSE)
Arguments
curves
a list of lists, each of which have at least two components: a vector of x
values and a vector of corresponding y
values. curves
is
mandatory except when method="mouse"
or "locator"
, in whi
z
a two-element list specifying the coordinate of the center of the key,
e.g. locator(1)
to use the mouse for positioning
labels
For labcurve
, a vector of character strings used to label curves
(which may contain newline characters to stack labels vertically). The
default labels are taken from the names of the curves
list.
Setting labels=FALSE
y
for putKeyEmpty
and largest.empty
, x
and y
are same-length
vectors specifying points that have been plotted. x
can also be
an object created by drawPlot
.
...
For drawPlot
is a series of invocations of Points
and
Curve
(see example). Any number of point groups can be defined
in this way. For Abline
these may be any arguments to
abline
.
For
height
for largest.empty
, specifies the minimum allowable width in x
units and
the minimum allowable height in y
units
method
"offset"
(the default) offsets labels at largest gaps between
curves, and draws labels beside curves.
"on top"
draws labels on top of the curves (especially
good when using keys).
"arrow"
draws arrows connecting
keys
This causes keys (symbols or short text) to be drawn on or beside
curves, and if keyloc
is not equal to "none"
, a legend to be
automatically drawn. The legend links keys with full curve labels
and optionally with colors and line
keyloc
When keys
is specified, keyloc
specifies how the legend
is to be positioned for drawing using the key
function in
trellis
. The default is "auto"
, for which the
largest.empty
fu
type
for labcurve
, a scalar or vector of character strings specifying the
method that the points in the curves were connected. "l"
means
ordinary connections between points and "s"
means step functions.
For putKey
step.type
type of step functions used (default is "left"
)
xmethod
method for generating the unique set of x-coordinates to examine (see above). Default is "grid"
for type="l"
or "unique"
for
type="s"
.
offset
distance in y-units between the center of the label and the line being
labeled. Default is 0.75 times the height of an "m" that would be
drawn in a label. For R grid/lattice you must specify offset using
the grid
unit
function,
xlim
limits for searching for label positions, and is also used to set up
plots when pl=TRUE
and add=FALSE
. Default is total x-axis
range for current plot (par("usr")[1:2]
). For
largest.empty
, xlim
tilt
set to TRUE
to tilt labels to follow the curves, for method="offset"
when keys
is not given.
window
width of a window, in x-units, to use in determining the local slope
for tilting labels. Default is 0.5 times number of characters in the
label times the x-width of an "m" in the current character size and font.
npts
number of points to use if xmethod="grid"
cex
character size to pass to text
and key
. Default is current
par("cex")
. For putKey
, putKeyEmpty
, and Points
is the size of the
plotting symbol.
adj
Default is "auto"
which has labcurve
figure justification
automatically when method="offset"
. This will cause centering to be used when the local angle
of the curve is less than angle.adj.auto
in absolu
angle.adj.auto
see adj
. Does not apply to step functions.
lty
vector of line types which were used to draw the curves.
This is only used when keys are drawn. If all of the
line types, line widths, and line colors are the same,
lines are not drawn in the key.
lwd
vector of line widths which were used to draw the curves.
This is only used when keys are drawn. See lty
also.
col
vector of integer color numbers for use in curve labels, symbols,
lines, and legends. Default is par("col")
for all curves.
See lty
also.
transparent
Default is TRUE
to make key
draw transparent legends, i.e., to
suppress drawing a solid rectangle background for the legend.
Set to FALSE
otherwise.
arrow.factor
factor by which to multiply default arrow lengths
point.inc
When keys
is a vector of integers, point.inc
specifies the x-increment
between the point symbols that are overlaid periodically on the curves.
By default, point.inc
is equal
to the range for the x-axis divided by 5
opts
an optional list which can be used to specify any of the options
to labcurve
, with the usual element name abbreviations allowed.
This is useful when labcurve
is being called from another
function. Example: opts=list(method
key.opts
a list of extra arguments you wish to pass to key()
, e.g.,
key.opts=list(background=1, between=3)
.
The argument names must be spelled out in full.
numbins
These two arguments are passed to the largest.empty
function's
method
and numbins
arguments (see below).
For largest.empty
specifies the number of bins in which to
discretize both the x
and
pl
set to TRUE
(or specify add
) to cause the curves in curves
to be
drawn, under the control of type
,lty
,lwd
,col
parameters defined
either in the curves
l
add
By default, when curves are actually drawn by labcurve
a new plot is
started. To add to an existing plot, set add=TRUE
.
ylim
When a plot has already been started, ylim
defaults to par("usr")[3:4]
.
When pl=TRUE
, ylim
and xlim
are determined from the ranges of the data.
Specify ylim
yourself to take con
ylab
x-axis and y-axis labels when pl=TRUE
and add=FALSE
or for
drawPlot
.
Defaults to ""
unless the first curve has names for its first two
elements, in which case the names of these elements are taken as
whichLabel
integer vector corresponding to curves
specifying which curves
are to be labelled or have a legend
grid
set to TRUE
if the R grid
package was used to draw the
current plot. This prevents labcurve
from using
par("usr")
etc. If using R grid
you can pass coordinates
and lengths having arbitrary
xrestrict
When having labcurve
label curves where they are most
separated, you can restrict the search for this separation point to a
range of the x-axis, specified as a 2-vector xrestrict
. This
is useful when one part of the curve
pch
vector of plotting characters for putKey
and putKeyEmpty
. Can be
any value including NA
when only a line is used to indentify the
group. Is a single plotting character for Points
, with the default
bein
file
a file name suffix. If specified, plot.drawPlot
will send its
output to a postscript file "file.ps" using the setps
function to
get nice defaults for inclusion in reports.
plot
set to FALSE
to keep putKey
or putKeyEmpty
from actually drawing the
key. Instead, the size of the key will be return by putKey
, or the
coordinates of the key by putKeyEmpty
.
ticks
tells drawPlot
which axes to draw tick marks and tick labels.
Default is "none"
.
key
for drawPlot
and plot.drawPlot
. Default is FALSE
so that labcurve
is used to label points or curves. Set to TRUE
to use
putKeyEmpty
.