map.z: Plot a Map of Data using Proportional Symbols

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

View source: R/map.z.R

Description

Displays a simple map where the data are represented by open circles whose diameters are proportional to the value of the data at their spatial locations. The rate of change of symbol diameter with value and the absolute size of the symbols are defined by the user. Optionally a legend may be displayed on the map.

Usage

1
2
3
4
5
map.z(xx, yy, zz, p = 0.5, sfact = 2.5, zmin = NA, zmax = NA, 
	xlab = "Easting", ylab = "Northing",
	zlab = deparse(substitute(zz)), main = "", tol = 0.04,
	col = 1, iflgnd = FALSE, title = deparse(substitute(zz)), 
	cex.lgnd = 0.8, ifparams = FALSE, cex.params = 0.8,  ...)

Arguments

xx

name of the x-axis spatial coordinate, the eastings.

yy

name of the y-axis spatial coordinate, the northings.

zz

name of the third variable, z, to be plotted as a map.

p

a parameter that controls the rate of change of symbol diameter with changing value. A default of p = 0.5 is provided. See Details below.

sfact

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

zmin

a value below which all symbols will be plotted at the same minumum size. By default zmin = NA which results in the minimum value of the variable defining the minimum symbol size. See Details below.

zmax

a value above which all symbols will be plotted at the same maximum size. By default zmax = NA which results in the maximum value of the variable defining the maximum symbol size. See Details below.

xlab

a title for the x-axis, defaults to Easting.

ylab

a title for the y-axis, defaults to Northing.

zlab

by default, zlab = deparse(substitute(zz)), a map title is generated by appending the input variable name text string to "Proportional Symbol Map for ". Alternative titles may be provided, see Details below.

main

an alternative map title, see Details below.

tol

a parameter used to ensure the area included within the neatline around the map is larger than the distribution of the points so that the plotted symbols fall within the neatline. By default tol = 0.04, if more clearance is required increase the value of tol.

col

the colour of the symbols, the default is black, col = 1. This may be changed if required, see display.lty for the default colour palette. For example, col = 2 will cause the symbols to be plotted in red.

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. See Notes below.

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 on the map, the default is cex.lgnd = 0.8.

ifparams

if ifparams = TRUE on completion of plotting and after the legend has been plotted, if requested, the cursor is activated, locate that at the top left corner of the desired text position and ‘left button’ on the pointing device. This text comprises three lines: the values of p to three significant figures and sfact; the maximum value of z to 3 significant figures and zmax; and the minimum value of z to 3 significant figures and zmin. The default is no text display.

cex.params

controls the size of the text for the parameters display, defaults to cex.params = 0.8.

...

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

Details

The symbol diameter is computed as a function of the value z to be plotted:
diameter = dmin + (dmax - dmin) * {(z - zmin)/(zmax - zmin)}^p
where dmin and dmax are defined as 0.1 and 1 units, so the symbol diameters range over an order of magnitude (and symbol areas over two); zmin and zmax are the observed range of the data, or the range over which the user wants the diameters to be computed; and p is a power defined by the user. The value of (z - zmin)/(zmax - zmin) is the value of z normalized, 0 - 1, to the range over which the symbol diameters are to be computed. After being raised to the power p, which will result in a number in the range 0 to 1, this value is multiplied by the permissable range of diameters and added to the minimum diameter. This results in a diameter between 0.1 and 1 units that is proportional to the value of z.

A p value of 1 results in a linear rate of change. Values of p less than unity lead to a rapid intial rate of change with increasing value of z which is often suitable for displaying positively skewed data sets, see the example below. In contrast, values of p greater than unity result in an initial slow rate of change with increasing value of z which is often suitable for displaying negatively skewed data sets. To obtain a logarithmic scaling set p = 0.3679, i.e. 1/e, and a value of p = 0.5 is equivalent to a square root transformation, the default, that is appropriate for a linear-area relationship. These values of p are equivalent to plotting log(x) or log10(x) and sqrt(x), respectively. Experimentation is often necessary to obtain a satisfactory visual effect. See syms.pfunc for a graphic demonstrating the effect of varying the p parameter.

If zmin or zmax are defined this has the effect of setting a minimum or maximum value of z, respectively, beyond which changes in the value of z do not result in changes in symbol diameter. This can be useful in limiting the effect of one, or a few, extreme outlier(s) while still plotting them, they simply plot at the minimum or maximum symbol size and are not involved in the calculation of the range of z over which the symbol diameters vary. Note: If the variable z includes a transform, e.g., log10(z), the values of zmin and/or zmax must be in those transform units.

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

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.

The legend consists of five proportional symbols and their corresponding z values: zmin; the three quartiles; and zmax. If zmin and zmax have been user defined it is over their range that the symbol sizes are computed and displayed. When defining zmin and/or zmax it is useful to set ifparams = TRUE as a reminder, whilst developing the required display.

Any NAs in the data vector are removed prior to displaying the plot.

In some R installations the generation of multi-panel displays and the use of function eqscplot from package MASS causes warning messages related to graphics parameters to be displayed on the current device. These may be suppressed by entering options(warn = -1) on the R command line, or that line may be included in a ‘first’ function prepared by the user that loads the ‘rgr’ package, etc.

Author(s)

Robert G. Garrett

See Also

syms, syms.pfunc, ltdl.fix.df, remove.na

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

## Plot a default symbol map, p = 0.5 and sfact = 2.5
map.z(UTME, UTMN, Cu)

## Plot a map where the symbols are logarithmically scaled,
## and more appropriately labelled axes
map.z(UTME/1000, UTMN/1000, Cu, p = 0.3679,
	xlab = "Kola Project UTM Eastings (km)",
	ylab = "Kola Project UTM Northings (km)" )


## Plot with differently scaled symbols and more appropriately 
## labelled axes
map.z(UTME/1000, UTMN/1000, Cu, p = 0.3, sfact = 2.0,
	xlab = "Kola Project UTM Eastings (km)",
	ylab = "Kola Project UTM Northings (km)" ) 

## Plot a map as above but where outliers above a value of 1000 are
## displayed with the same symbol
map.z(UTME/1000, UTMN/1000, Cu, p = 0.3, sfact = 2.0, zmax = 1000,
	xlab = "Kola Project UTM Eastings (km)",
	ylab = "Kola Project UTM Northings (km)" )

## Detach test data
detach(kola.o) 

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

Related to map.z in rgr...