Multiple (max 9) Cumulative Normal Probability (CPP) plots

Share:

Description

Displays cumulative normal probability (CPP) plots for up to nine data subsets, using combinations of symbols and colours to identify each subset. Note CPP plots are equivalent to Q-Q plots and are more frequently used by physical scientists and engineers.

Usage

1
2
gx.cnpplts(xlab = " ", log = FALSE, xlim = NULL, main = "",
	iflgnd = FALSE, ...)

Arguments

xlab

a title for the x-axis must be provided, even if it is ‘no title’, i.e. xlab = "", or an informative title may be provided, see Examples.

log

to display the data with logarithmic (x-axis) scaling, set log = TRUE.

xlim

if the internally generated values for xlim are to be replaced see the Note below. If the internally generated x-axis limits are satisfactory omit any reference to xlim in the call to the function.

main

a title must be provided, even if it is ‘no title’, i.e. main = "". If main is specified a title will be added above the plot, e.g., main = "Kola Project, 1995".

iflgnd

iflgnd must be specified, TRUE or FALSE. If a R generated legend is to be be placed on the plot, set iflgnd = TRUE. On completion of CPP plotting the cursor is activated, locate it at the top left of the space where the legend is to be added and ‘left button’ on the pointing device. The legend comprises the symbol/colour combination, the name of the subset plotted and the data subset size; this information is also displayed on the current device. If no legend is required, set iflgnd = FALSE.

...

the names of the data subsets (objects), separated by commas, to be plotted, up to a maximum of nine. See the example below for subset pre-processing steps that lead to a more presentable legend.

Details

Unlike most other functions in ‘rgr’ all the arguments must be specified explicitly, except xlim. This is the cost of being able to append up to nine subset names in the function call. The function needs to know where subset names start in the list passed to the function.

A default allocation of symbols and colours, and the size of the legend text, is provided in
gx.cnpplts.setup. These may be edited if required, they are imported into gx.cnpplts at function run time.

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

Although this function is most frequently used to compare the frequency distributions for the same element in multiple subsets of the data, it may also be used to display frequency distributions for multiple elements.

If it is required to set the x-axis limits to specific values they 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 = TRUE. If the defined limits lie within the observed data range a truncated plot will be displayed. Setting the limits wider than the default limits can provide additional space for annotation of the display.

By setting iflgnd = FALSE no internally generated legend will be added. Alternately, a legend can be constructed with the text function and placed with the locator at execution of the text function.

Author(s)

Robert G. Garrett

See Also

gx.cnpplts.setup, display.marks, display.lty, ltdl.fix.df, text

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
## Make test data available
data(kola.c)
attach(kola.c)

## An example
gx.cnpplts(xlab = "Cu (mg/kg) in <2 mm Kola C-horizon soil", log = TRUE, 
	xlim = NULL, main = "", iflgnd = FALSE, Cu[COUNTRY == "RUS"], 
	Cu[COUNTRY == "FIN"], Cu[COUNTRY == "NOR"])

## An example that leads to a cleaner legend
## First select data for the variable to be plotted for the subsets, from
## dimnames(kola.c) we know that Be is the 19th column in the data frame
Norway <- gx.subset(kola.c,COUNTRY=="NOR")[,19]
Russia <- gx.subset(kola.c,COUNTRY=="RUS")[,19]
Finland <- gx.subset(kola.c,COUNTRY=="FIN")[,19]
gx.cnpplts(xlab = "Be (mg/kg) in <2 mm Kola C-horizon soils", log = TRUE,
	xlim = NULL, main  ="", iflgnd = FALSE, Finland, Russia, Norway)

## An example where the limits of the x-axis are provided
gx.cnpplts(xlab = "Be (mg/kg) in <2 mm Kola C-horizon soils", log = TRUE,
	xlim = c(0.02, 20), main  ="", iflgnd = FALSE, Finland, Russia, Norway)

## An example of a multi-element display
gx.cnpplts(xlab = "Concentrations (mg/kg) in <2 mm Kola C-horizon soils",
	log = TRUE, xlim = NULL, main = "Kola Project, 1995", 
	iflgnd = FALSE ,Cu, Ni, Co)

## Clean-up and detach test data
rm(Norway)
rm(Russia)
rm(Finland)
detach(kola.c)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.