xyplot.eda8: Display a Third Variable in a X-Y Plot as Percentiles

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

Description

Displays a third variable on a X-Y plot where the the third variable is represented by symbols indicating within which group defined by the data's 2nd, 5th, 25th, 50th, 75th, 95th and 98th percentiles plotted a data value falls. The colours of the symbols may be optionally changed. The x-y plot axes may be optionally displayed with logarithmic (base 10) scaling. Optionally a legend (two options) may be added to the plot.

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
4
5
xyplot.eda8(xx, yy, zz, sfact = 1, xlim = NULL, ylim = NULL, 
	xlab = deparse(substitute(xx)), ylab = deparse(substitute(yy)), 
	zlab = deparse(substitute(zz)), main = "", log = NULL,
	ifgrey = FALSE, symcolr = NULL, iflgnd = FALSE, pctile = FALSE,
	title = deparse(substitute(zz)), cex.lgnd = 0.8, ...)

Arguments

xx

name of the x-axis variable.

yy

name of the y-axis variable.

zz

name of the third variable to be plotted.

sfact

controls the absolute size of the plotted symbols, by default sfact = 1. Increasing sfact results in larger symbols.

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.

zlab

by default the character string for zz is appended to the text string “EDA Percentile Based Plot for” for the plot title. An alternate title can be displayed with zlab = "text string", see Details below.

main

an alternative plot title, see Details below.

ifgrey

set ifgrey = TRUE if a grey-scale plot is required, see Details below.

symcolr

the default is a colour plot and default colours are provided, deeper blues for lower values, green for the middle 50% of the data, and oranges and reds for higher values. A set of alternate symbol colours can be provided by defining symcolr, see Details below.

iflgnd

the default is no legend. If a legend is required set iflgnd = TRUE, following the plotting of the data the cursor will be activated, locate that at the top left corner of the desired legend position and ‘left button’ on the pointing device. There are two legends to choose from, see pctile below.

pctile

the default legend displays the range of values each symbol represents. Alternately, the percentiles may be displayed rather than their values by setting pctile = TRUE.

title

a short title for the legend, e.g., title = "Zn (mg/kg)". The default is the character string for zz.

cex.lgnd

controls the scaling of the legend box and text, but not the symbols so that they match those in the plot, the default is cex.lgnd = 0.8.

...

further arguments to be passed to methods. For example, if it is required to make the plot title smaller, add cex.main = 0.9 to reduce the font size by 10%.

Details

The selected percentiles, 2nd, 5th, 25th, 50th, 75th, 95th and 98th, divide the data into 8 groups. Values below the median are represented by increasingly larger deeper blue circles below the 25th percentile (Q1), and values above the 75th percentile (Q3) by increasingly larger orange and red squares. The mid 50% of the data are represented by green symbols, circles for the median (Q2) to Q1, and squares for the median (Q2) to Q3.

A summary table of the values of the symbol intervals, the number of values plotting as each symbol, and symbol shapes, sizes and colours is displayed on the current device.

If zlab and main are undefined a default a plot title is generated by appending the input variable name text string to "EDA Percentile Based Plot for ". If no plot title is required set zlab = " ", and if some user defined plot title is required it should be defined in main, e.g. main = "Plot Title Text".

If the grey-scale option is chosen the symbols are plotted 100% black for the far outliers, 85% black for the near outliers, 70% black for values within the whiskers, and 60% black for values falling within the middle 50% of the data.

The default colours, symcolr = c(25, 22, 20, 13, 13, 6, 4, 1), are selected from the rainbow(36) pallette, and alternate colour schemes need to be selected from the same palette. See display.rainbow for the available colours. It is essential that 8 colours be provided, e.g., symcolr = c(27, 24, 22, 12, 12, 5, 3, 36), if exactly 8 are not provided the default colours will be displayed.

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 data vectors including NAs are removed prior to displaying the plot.

Author(s)

Robert G. Garrett

See Also

display.rainbow, ltdl.fix.df, remove.na, 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
37
38
39
40
41
42
## Make test data available
data(sind)
attach(sind)

## Plot a default percentile display
xyplot.eda8(Fe, Mn, Zn)

## Plot with more appropriate axis scaling and labelling
## with a user specified title
xyplot.eda8(Fe, Mn, Zn, sfact = 2.0, log = "y",
	xlab = "Fe (pct) in stream sediment",
	ylab = "Mn (mg/kg) in stream sediment",
	main = "Howarth & Sinding-Larsen Test Data\nZn (mg/kg)") 

## Display a grey-scale equivalent of the above plot
xyplot.eda8(Fe, Mn, Zn, sfact = 2, log = "y", ifgrey = TRUE,
	xlab = "Fe (pct) in stream sediment",
	ylab = "Mn (mg/kg) in stream sediment",
	main = "Howarth & Sinding-Larsen Test Data\nZn (mg/kg)") 

## Plot the same display with an alternate colour scheme
xyplot.eda8(Fe, Mn, Zn, sfact = 2, log = "y",
	xlab = "Fe (pct) in stream sediment",
	ylab = "Mn (mg/kg) in stream sediment",
	main = "Howarth & Sinding-Larsen Test Data\nZn (mg/kg)",
	symcolr = c(27, 24, 22, 12, 12, 5, 3, 36)) 

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

## More appropriately for compositional data
data(nockolds)
attach(nockolds)

## Plot a minor element log ratio against the symmetric coordinates for
## Si and Al
xyplot.eda8(gx.symm.coords.mat(nockolds, 1, 2), log(P/Ti))

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

Example output

Loading required package: MASS
Loading required package: fastICA

	Cut Levels	 No. of Symbols   Symbol - size - Colour 
						sfact = 1.00 

			       1 	     Circle 2.00    25 
	 23.48 	 4 %
			       1 	     Circle 1.50    22 
	 24.2 	 8 %
			       5 	     Circle 1.00    20 
	 33 	 28 %
			       6 	     Circle 0.50    13 
	 48 	 52 %
			       6 	     Square 0.50    13 
	 89 	 76 %
			       4 	     Square 1.00    6 
	 555 	 92 %
			       1 	     Square 1.50    4 
	 794 	 96 %
			       1 	     Square 2.00    1 
Warning messages:
1: In par(old.par) : graphical parameter "cin" cannot be set
2: In par(old.par) : graphical parameter "cra" cannot be set
3: In par(old.par) : graphical parameter "csi" cannot be set
4: In par(old.par) : graphical parameter "cxy" cannot be set
5: In par(old.par) : graphical parameter "din" cannot be set
6: In par(old.par) : graphical parameter "page" cannot be set

	Cut Levels	 No. of Symbols   Symbol - size - Colour 
						sfact = 2.00 

			       1 	     Circle 4.00    25 
	 23.48 	 4 %
			       1 	     Circle 3.00    22 
	 24.2 	 8 %
			       5 	     Circle 2.00    20 
	 33 	 28 %
			       6 	     Circle 1.00    13 
	 48 	 52 %
			       6 	     Square 1.00    13 
	 89 	 76 %
			       4 	     Square 2.00    6 
	 555 	 92 %
			       1 	     Square 3.00    4 
	 794 	 96 %
			       1 	     Square 4.00    1 
Warning messages:
1: In par(old.par) : graphical parameter "cin" cannot be set
2: In par(old.par) : graphical parameter "cra" cannot be set
3: In par(old.par) : graphical parameter "csi" cannot be set
4: In par(old.par) : graphical parameter "cxy" cannot be set
5: In par(old.par) : graphical parameter "din" cannot be set
6: In par(old.par) : graphical parameter "page" cannot be set

	Cut Levels	 No. of Symbols   Symbol - size - Colour 
						sfact = 2.00 

			       1 	     Circle 4.00    #000000 
	 23.48 	 4 %
			       1 	     Circle 3.00    #262626 
	 24.2 	 8 %
			       5 	     Circle 2.00    #4D4D4D 
	 33 	 28 %
			       6 	     Circle 1.00    #666666 
	 48 	 52 %
			       6 	     Square 1.00    #666666 
	 89 	 76 %
			       4 	     Square 2.00    #4D4D4D 
	 555 	 92 %
			       1 	     Square 3.00    #262626 
	 794 	 96 %
			       1 	     Square 4.00    #000000 
Warning messages:
1: In par(old.par) : graphical parameter "cin" cannot be set
2: In par(old.par) : graphical parameter "cra" cannot be set
3: In par(old.par) : graphical parameter "csi" cannot be set
4: In par(old.par) : graphical parameter "cxy" cannot be set
5: In par(old.par) : graphical parameter "din" cannot be set
6: In par(old.par) : graphical parameter "page" cannot be set

	Cut Levels	 No. of Symbols   Symbol - size - Colour 
						sfact = 2.00 

			       1 	     Circle 4.00    27 
	 23.48 	 4 %
			       1 	     Circle 3.00    24 
	 24.2 	 8 %
			       5 	     Circle 2.00    22 
	 33 	 28 %
			       6 	     Circle 1.00    12 
	 48 	 52 %
			       6 	     Square 1.00    12 
	 89 	 76 %
			       4 	     Square 2.00    5 
	 555 	 92 %
			       1 	     Square 3.00    3 
	 794 	 96 %
			       1 	     Square 4.00    36 
Warning messages:
1: In par(old.par) : graphical parameter "cin" cannot be set
2: In par(old.par) : graphical parameter "cra" cannot be set
3: In par(old.par) : graphical parameter "csi" cannot be set
4: In par(old.par) : graphical parameter "cxy" cannot be set
5: In par(old.par) : graphical parameter "din" cannot be set
6: In par(old.par) : graphical parameter "page" cannot be set
  ** Are the data/parts all in the same measurement units? **

	Cut Levels	 No. of Symbols   Symbol - size - Colour 
						sfact = 1.00 

			       1 	     Circle 2.00    25 
	 -2.797 	 6.2 %
			       0 	     Circle 1.50    22 
	 -2.339 	 6.2 %
			       3 	     Circle 1.00    20 
	 -1.797 	 25 %
			       4 	     Circle 0.50    13 
	 -1.373 	 50 %
			       4 	     Square 0.50    13 
	 -1.21 	 75 %
			       3 	     Square 1.00    6 
	 -0.5659 	 93.8 %
			       0 	     Square 1.50    4 
	 -0.3716 	 93.8 %
			       1 	     Square 2.00    1 
Warning messages:
1: In par(old.par) : graphical parameter "cin" cannot be set
2: In par(old.par) : graphical parameter "cra" cannot be set
3: In par(old.par) : graphical parameter "csi" cannot be set
4: In par(old.par) : graphical parameter "cxy" cannot be set
5: In par(old.par) : graphical parameter "din" cannot be set
6: In par(old.par) : graphical parameter "page" cannot be set

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

Related to xyplot.eda8 in rgr...