Learn R Programming

rgr (version 1.1.15)

gx.cnpplts: Multiple (max 9) Cumulative Normal Probability (CPP) plots

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

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.

See Also

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

Examples

Run this code
# NOT RUN {
## 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)
# }

Run the code above in your browser using DataLab