Title: | Groundwater Data Presentation and Interpretation |
---|---|
Description: | Contains one function for drawing Piper diagrams (also called Piper-Hill diagrams) of water analyses for major ions. |
Authors: | Myles English <[email protected]> |
Maintainer: | Myles English <[email protected]> |
License: | BSD_2_clause + file LICENCE |
Version: | 0.6-1 |
Built: | 2024-12-11 07:08:23 UTC |
Source: | CRAN |
Contains one function, for drawing Piper (or Piper-Hill) diagrams from water analyses for major ions, and a dataset from Zaporozec
Package: | hydrogeo |
Type: | Package |
Version: | 0.5-1 |
Date: | 2016-11-17 |
License: | BSD |
LazyLoad: | yes |
Myles English [email protected]
library(hydrogeo) data(zaporozec) zaporozec$CO3 <- rep(0,9) # toPercent expects CO3 zaporozec$Na <- rep(0,9) # toPercent expects Na z <- toPercent(zaporozec) pz <- piper(z) plot(pz,cex=1.5)
library(hydrogeo) data(zaporozec) zaporozec$CO3 <- rep(0,9) # toPercent expects CO3 zaporozec$Na <- rep(0,9) # toPercent expects Na z <- toPercent(zaporozec) pz <- piper(z) plot(pz,cex=1.5)
Create a new piper object
piper(d, ...)
piper(d, ...)
d |
list passed to class piper, |
... |
additional arguments, as for |
piper-class
and toPercent
piper
Objects of this class are plotable as Piper-Hill diagrams. A dataframe of major ions as percentages can be used to initialise a piper object.
## S4 method for signature 'piper' initialize(.Object, l, ..., call = NULL, pt.col = NULL) ## S4 method for signature 'piperplot' labelAxes(x, cex.axis = 0.35, side = -1, ...) ## S4 method for signature 'piper' plot(x, type = "p", cex = 0.75, ...) ## S4 method for signature 'piper' show(object)
## S4 method for signature 'piper' initialize(.Object, l, ..., call = NULL, pt.col = NULL) ## S4 method for signature 'piperplot' labelAxes(x, cex.axis = 0.35, side = -1, ...) ## S4 method for signature 'piper' plot(x, type = "p", cex = 0.75, ...) ## S4 method for signature 'piper' show(object)
.Object |
object of class piper |
l |
list of data, see 'Examples' below |
... |
additional arguments, as for |
call |
the call that asked for the new piper object |
pt.col |
Object of class |
x |
an object of class piperplot |
cex.axis |
magnification to be used for axis annotation relative to the current setting of 'cex', see help("par") |
side |
integer between 1 and 10 specifying which side to lable, the default is to label all |
type |
what type of plot should be drawn, only "p" for *p*oints is useful |
cex |
magnification to be used for symbols relative to the current setting of 'cex', see help("par") |
object |
an object of class piper |
initialize
: Initialiser
labelAxes
: Label the axes
plot
: Plot an object of class piper
show
: Show an object of class piper
Ca
Object of class vector
— Calcium
Mg
Object of class vector
— Magnesium
Cl
Object of class vector
— Chloride
SO4
Object of class vector
— Sulphate
anion.x
x coordinate of the point on the anion triangle (internal)
anion.y
y coordinate of the point on the anion triangle (internal)
cation.x
x coordinate of the point on the cation triangle (internal)
cation.y
y coordinate of the point on the cation triangle (internal)
diamond.x
x coordinate of the point on the diamond (internal)
diamond.y
y coordinate of the point on the anion diamond (internal)
IDs
Object of class vector
of sample identifiers
pt.col
Object of class vector
of colours for points
pt.pch
Object of class vector
of symbols for points
call
Object of class character
— call that created it
Myles English [email protected]
A. Zaporozec, “Graphical interpretation of water quality data,” Ground Water 10, no. 2 (1972): 32–43.
showClass("piper") l <- list( Ca = c(43,10,73,26,32), Mg = c(30,50,3,14,12), Cl = c(24,10,12,30,43), SO4 = c(24,10,12,30,43)) lp <- piper(l) plot( lp, main="Piper-Hill Diagram of Water Quality" ) # change symbols and colours to differentiate water type groups [email protected] = c(2,2,4,4,4) [email protected] = c(0,1,0,1,2) # use larger symbols plot( lp, main="Piper-Hill Diagram of Water Quality", cex=1.4 )
showClass("piper") l <- list( Ca = c(43,10,73,26,32), Mg = c(30,50,3,14,12), Cl = c(24,10,12,30,43), SO4 = c(24,10,12,30,43)) lp <- piper(l) plot( lp, main="Piper-Hill Diagram of Water Quality" ) # change symbols and colours to differentiate water type groups lp@pt.pch = c(2,2,4,4,4) lp@pt.col = c(0,1,0,1,2) # use larger symbols plot( lp, main="Piper-Hill Diagram of Water Quality", cex=1.4 )
Create a new piperplot object
piperPaper(size = NULL, ...)
piperPaper(size = NULL, ...)
size |
integer related to the size of the plot area |
... |
additional arguments, as for |
library(hydrogeo) p = piperPaper(size=1) plot(p)
library(hydrogeo) p = piperPaper(size=1) plot(p)
piperplot
Objects of this class are plottable as empty (i.e. no points) Piper-Hill diagrams
## S4 method for signature 'piperplot' Axis(x = NULL)
## S4 method for signature 'piperplot' Axis(x = NULL)
x |
an object of class piperplot |
Axis
: Add axes to a piperplot
size
Object of class numeric
— Length of the (square) plot
area, defaults to 300
call
R call that created it
Plot the diagram area with two triangles and a diamond
## S4 method for signature 'piperplot' plot(x, axes = TRUE, ...)
## S4 method for signature 'piperplot' plot(x, axes = TRUE, ...)
x |
object of class piperplot |
axes |
logical saying whether to draw the axes or not, defaults to TRUE |
... |
further arguments to plot.default |
Major ions as a percentage of total major ions - Test Data
testData(n)
testData(n)
n |
Number of test samples to be generated. |
library(hydrogeo) lp <- piper( testData(26) )
library(hydrogeo) lp <- piper( testData(26) )
Expects certain column names
toPercent(d)
toPercent(d)
d |
list or data.frame with the following columns: Ca, Mg, Na, K and Cl, SO4, CO3, HCO3 |
library(hydrogeo) l <- list( Ca = c(43,10,73,26,32), Mg = c(30,50,83,14,62), Na = c(54,76,3,14,12), K = c(31,22,32,22,11), Cl = c(24,10,12,30,43), SO4 = c(24,10,12,30,43), CO3 = c(24,10,12,30,43), HCO3 = c(42,110,12,3,4), IDs = c("A","B","C","D","E") ) d <- toPercent(l) # check, should add up to 100% z <- as.data.frame(d) for(i in 1:length(z[[1]])) { print(sum(z[i,5:8])) } for(i in 1:length(z[[1]])) { print(sum(z[i,1:4])) }
library(hydrogeo) l <- list( Ca = c(43,10,73,26,32), Mg = c(30,50,83,14,62), Na = c(54,76,3,14,12), K = c(31,22,32,22,11), Cl = c(24,10,12,30,43), SO4 = c(24,10,12,30,43), CO3 = c(24,10,12,30,43), HCO3 = c(42,110,12,3,4), IDs = c("A","B","C","D","E") ) d <- toPercent(l) # check, should add up to 100% z <- as.data.frame(d) for(i in 1:length(z[[1]])) { print(sum(z[i,5:8])) } for(i in 1:length(z[[1]])) { print(sum(z[i,1:4])) }
This data set contains major ion analyses for three groundwaters.
A data frame with 9 observations on the following 15 variables:
location
a factor with levels Tertiary, Czechoslovakia
Upper Cambrian, Wisconsin
Upper Cretaceous, Czechoslovakia
K
a numeric vector - potassium
Mg
a numeric vector - magnesium
Ca
a numeric vector - calcium
Mn
a numeric vector - magnesium
Fe
a numeric vector - iron
Cl
a numeric vector - chloride
NO3
a numeric vector - nitrate
HCO3
a numeric vector - bicarbonate
SO4
a numeric vector - sulphate
sigma
a numeric vector - standard deviation
TDS
a numeric vector - total dissolved solids
tempC
a numeric vector - temperature
pH
a numeric vector - pH
units
a factor with levels meq/l
meq_pc
mg/l
Zaporozec, “Graphical interpretation of water quality data,” Ground Water 10, no. 2 (1972): pages 32–43.
data(zaporozec) str(zaporozec)
data(zaporozec) str(zaporozec)