Learn R Programming

rgr (version 1.1.0)

xyplot.tags: Display a Plot of Posted Values for a Third Variable

Description

Displays a x-y plot where the data for a third variable are represented by the written values of the data at their x-y position.

Usage

xyplot.tags(xx, yy, tag, log = NULL, xlim = NULL, ylim = NULL,
        xlab = deparse(substitute(xx)), ylab = deparse(substitute(yy)),
        taglab = deparse(substitute(tag)),  main = "", ...)

Arguments

xx
name of the x-axis variable.
yy
name of the y-axis variable.
tag
name of the third variable to be displayed.
log
if it is required to display the data with logarithmic axis scaling, set log = "x" for a logarithmically scaled x-axis, log = "y" for a logarithmically scaled y-axis, and log = "xy" for both axes logarithmically scal
xlim
user defined limits for the x-axis, see Details below.
ylim
user defined limits for the y-axis, see Details below.
xlab
the x-axis title, by default the variable name, deparse(substitute(xx)). It is often desirable to replace the default x-axis title of the input variable name text string with a more informative title, e.g., xlab = "Fe (mg/kg) in stream
ylab
the y-axis title, by default the variable name, deparse(substitute(yy)). It is often desirable to replace the default y-axis title of the input variable name text string with a more informative title, e.g., ylab = "Mn (mg/kg) in stream
taglab
text to be inserted in the plot title, by default deparse{substitute{tag}} is used. See Details below.
main
an alternative plot title, see Details below.
...
further arguments to be passed to methods. For example, if smaller plotting characters are required, specify cex = 0.8; or if some colour other than black is required for the plotting characters, specify col = 2 to obtain red (s

Details

If taglab and main are undefined a default a plot title is generated by appending the input variable name text string to "Plot of Values for ". If no plot title is required set zlab = "", or if an alternative to the variable name taglab is required it may be specified, taglab = "Alternative". If some user defined plot title is required it should be defined in main, e.g., main = "Plot Title Text", in which instance taglab is ignored. If the default selection for xlim is inappropriate it can be set, e.g., xlim = c(0, 200) or c(2, 200), the latter being appropriate for a logarithmically scaled plot, i.e. log = "x". If the defined limits lie within the observed data range a truncated plot will be displayed. The same procedure applies to setting ylim. If a plot of sample numbers, IDs, is required and they are not explicitly in the dataframe, a plot of dataframe row numbers may be displayed by specifying dimnames(dfname)[[1]] as the value of tags.

See Also

ltdl.fix.df, remove.na, display.lty

Examples

Run this code
## Make test data available
data(sind)
attach(sind)

## Plot the sample site IDs in the x-y space
xyplot.tags(Fe, Mn, ID)

## Plot the dataframe row numbers in the x-y space and appropiately
## scale the y-axis
xyplot.tags(Fe, Mn, dimnames(sind)[[1]], log = "y")

## Plot the values for zinc (Zn) in smaller red text in the x-y
## space, providing more appropriate axis scaling and labelling,
## and adding a user specified title
xyplot.tags(Fe, Mn, Zn, log = "y", xlab = "Fe (pct) in stream sediment",
	ylab = "Mn (mg/kg) in stream sediment",
	main = "Howarth & Sinding-Larsen Test Data
Zn (mg/kg)", cex = 0.8, col = 2) 

## Detach test data
detach(sind)

Run the code above in your browser using DataLab