genplot: Plot of concentration time series

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

View source: R/genplot.R

Description

Function genplot allows to draw points of time series of persistent organic pollutant concentration. Several parametric and non-parametric interlacing curves are available and optional (linear and exponential) and three possibilities of drawing confidence interval of the trend line (none, one-coloured and gradient).

Usage

1
2
3
4
5
genplot(x, y=NA, input="openair", pollutant=NA, plot=TRUE,
        distr="lnorm", xlim=c(NA,NA), ylim=c(NA,NA), n=NA, 
        col="#A52375", col.points="black", pch=1, il="ls", 
        ci=TRUE, r=0.95, columns=2, xlab="Date",
        ylab="Concentration", main=NA)

Arguments

x

vector of concentration values or data frame of genasis/openair type. See 'Details' for more detailed description of both data types.

y

vector of measurement dates in the case of vector input only.

input

type of data.frame in the case of data.frame input. The allowed values are "openair" (default) and "genasis". In case of vector input, this argument is meaningless.

pollutant

name of the pollutant(s), for which the plot is plotted. Not necessary if only data for one pollutant is available in x. If not specified, plots for all pollutants are drawn in a multi-plot arrangement.

plot

logical. Indicates, whether plot should be plotted.

xlim

"character" or "Date" class vector of length 2, giving the x axis coordinates ranges.

ylim

numeric vector of length 2, giving the y axis coordinates ranges.

n

number of breaks of interlacing line. If not specified, n is equal to the number of concentration values.

col

color of interlacing line and confidence interval area, if chosen.

col.points

color of points inside the plot.

pch

plotting "character", i.e., symbol to use. For more details see points.

il

type of the interlacing curve. Value "ls" leads to least square fitting of the curve, value "ts" leads to a non-parametric Theil-Sen curve. If the value is "", no curve is plotted.

distr

shape of the interlacing curve. Value "norm" leads to a linear interpolation, value "lnorm" to an exponential. If the value is "", no curve is plotted.

ci

indicates, whether confidence interval of interlacing curve should be plotted. The allowed values are TRUE (default), FALSE and "gradient".

r

significance level of the confidence interval as a positive number between 0 and 1.

columns

number of columns in the multi-plot arrangement.

xlab

the x label of the plot.

ylab

the y label of the plot.

main

overall title for the plot.

Details

The genplot function enables to draw a plot of concentration time series. The function recognises three different input formats: Option input="openair" uses openair format of data frame with first column of name "date" and type Date, optional columns of names "date_end", "temp", "wind" and "note" and other columns of class "numeric" containing concentration values and named by names of the compounds. input="genasis" is used for the data frame with six columns "valu", "comp", "date_start", "date_end", "temp" and "wind" where the first, fifth and sixth are of class "numeric", second of class "character" and third and fourth columns could be both "character" or "Date" class. The names of columns in input="genasis" are not rigid, only their order is assumed. There is also a possibility to specify x and y as two vectors of equal lenght, first of class "numeric" containing concentration values, second of class "character" or "Date" containing measurement dates.

In all cases of input, if both start and end date are given, the date point is plotted as a middle of measurement period, if only one date is given, it is used directly.

There are two options for plotting interlacing line of concentrations. distr="lnorm" (default) expects lognormal distribution and plots exponential trend, while distr="norm" expects roughly normal distribution of concentration data and plots linear trend.

Two methods of interlacing are available under the argument il. il="ls" (default) deploys least squares method, while il="ts" deploys the Theil-Sen linear (or log-transformed exponential) estimator.

Confidence intervals of trend lines are also available by the option ci with available values TRUE (default) for one-coluored area, "gradient" for probability gradient and FALSE for no confidence interval to be drawn. The default significance level of the confidence interval r is set up to 0.95.

Default values of col and col.points parameters to specify colours of regression line and points in the plot are set up to #A52375 and black, default shape of points pch is set up to standard circles (1).

In a case of multiple pollutants specified, the argument columns specifies the number of columns in resulting table of plots. Be careful with plotting higher numbers of plots - usual devices are not large enough to plot more than four plots at once, there is a need to set up sufficiently high and broad space for plotting inside the device settings.

Main label and axes labels could be specified in main, xlab and ylab. A name of the pollutant is added after the user-set up label. If no specification is given, the name of the pollutant is used in main and "Date" and "Concentration" in axes labels.

Value

a list containing:

slope

slope of the regression line (in the case of exponential line, it is in a form of exponent of exp(x)).

intercept

slope of the regression line (in the case of exponential line, it is in a form of multiplicative constant).

belt

x-coordintaes (as "Data" class vector) of line breaks.

line

y-coordintaes (concentration as "numeric" class vector) of line breaks.

lower

y-coordintaes (as "Data" class vector) of confidence interval area lower border breaks.

upper

y-coordintaes (as "Data" class vector) of confidence interval area upper border breaks.

Author(s)

Jiri Jarkovsky
Jiri Kalina
kalina@mail.muni.cz

See Also

genloq, genoutlier, genhistogram, genpastoact, genanaggr, genstatistic, gentransform, genwhisker

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Definition of simple data sources:
c1<-c(0.386,0.256,0.182,0.254)
c2<-"fluorene"
c3<-c("2013-05-01","2013-06-03","2013-07-05","2013-08-07")
c4<-c("2013-05-08","2013-06-10","2013-07-12","2013-08-14")

sample_genasis<-data.frame(c1,c2,c3,c4)
sample_openair<-data.frame(c4,c1)
colnames(sample_openair)=c("date","fluorene")

## Examples of different usages:
genplot(sample_openair,input="openair",pollutant="fluorene",distr="lnorm",
        n=10,ci="gradient",col="black",col.points="red",pch=15)
genplot(sample_genasis,input="genasis",n=10,col="blue")
genplot(c1,c3,ci=FALSE,pch=1,main="fluorene")

## Use of example data from the package:
data(kosetice.pas.openair)
genplot(kosetice.pas.openair[,1:8],col="orange",il="ts",ci=FALSE)
data(kosetice.pas.genasis)
## Not run: genplot(kosetice.pas.genasis[1:208,],input="genasis",
         distr="lnorm",ci="gradient",col="orange")
## End(Not run)

genasis documentation built on May 1, 2019, 10:16 p.m.

Related to genplot in genasis...