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

Description Usage Arguments Details Note Author(s) See Also Examples

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. The x-y plot axes may be optionally displayed with logarithmic (base 10) scaling.

Where the x-y data are parts from a composition they should be plotted as symmetric coordinates, and the third variable as a log-ratio if it is from the same composition.

Usage

1
2
3
xyplot.tags(xx, yy, tag = NULL, log = NULL, xlim = NULL, ylim = NULL,
	xlab = deparse(substitute(xx)), ylab = deparse(substitute(yy)),
	taglab = NULL, 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 scaled.

xlim

user defined limits for the x-axis, see Details below.

ylim

user defined limits for the y-axis, see Details below.

xlab

by default the character string for xx is used for the x-axis title. An alternate title can be displayed with xlab = "text string", see Examples.

ylab

by default the character string for yy is used for the y-axis title. An alternate title can be displayed with ylab = "text string", see Examples.

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 (see display.lty for the default colour palette). If it is required to make the plot title smaller, add cex.main = 0.9 to reduce the font size by 10%.

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 taglab = " ", 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 data frame, a plot of data frame row numbers may be displayed by specifying dimnames(dfname)[[1]] as the value of tags.

For compositional data the function gx.symm.coords.mat is required, and arguments xx and yy are replaced by a call to that function which returms the symmetric coordinated for those parts of the composition, and the axes are labelled appropriately. See example below.

Note

Any less than detection limit values represented by negative values, or zeros or other numeric codes representing blanks in the data, must be removed prior to executing this function, see ltdl.fix.df.

Any NAs in the x-y coordinate vectors are removed prior to displaying the plot, thus those ‘data’ are not plotted. However, any NAs in the third variable to be plotted are replaced with a ‘+’ sign to indicate data for the third variable are ‘missing’.

Author(s)

Robert G. Garrett

See Also

ltdl.fix.df, remove.na, display.lty, gx.symm.coords.mat

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
## 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 data frame 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\nZn (mg/kg)", cex = 0.8, col = 2) 

# Detach test data
detach(sind)
rm(sind) 

## More appropriately for compositional data
data(nockolds)

## Plot the lithological abbreviations against the symmetric
## coordinates for Si and Al
xyplot.tags(gx.symm.coords.mat(nockolds, 1, 2), dimnames(nockolds)[[1]])

## Plot the lithological abbreviations against the symmetric
## coordinates for Si and Al more appropriately scaled and titled
xyplot.tags(gx.symm.coords.mat(nockolds, 1, 2), dimnames(nockolds)[[1]],
        cex = 0.7, main = "Display of lithological abbreviations" )

## Detach test data
rm(nockolds)

Example output

Loading required package: MASS
Loading required package: fastICA
  ** Are the data/parts all in the same measurement units? **
  ** Are the data/parts all in the same measurement units? **

rgr documentation built on May 2, 2019, 6:09 a.m.

Related to xyplot.tags in rgr...