Description Usage Arguments Details Note Author(s) See Also Examples
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.
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 = "", ...)
|
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 |
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 |
ylab |
by default the character string for |
taglab |
text to be inserted in the plot title, by default |
main |
an alternative plot title, see Details below. |
... |
further arguments to be passed to methods. For example, if smaller plotting characters are required, specify |
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.
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 NA
s in the x-y coordinate vectors are removed prior to displaying the plot, thus those ‘data’ are not plotted. However, any NA
s in the third variable to be plotted are replaced with a ‘+’ sign to indicate data for the third variable are ‘missing’.
Robert G. Garrett
ltdl.fix.df
, remove.na
, display.lty
, gx.symm.coords.mat
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.