plot.Torgegram: Plotting Method for Torgegram Objects

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

View source: R/plot.Torgegram.r

Description

plot.Torgegram is a generic plot function that has been adapted for Torgegram objects, which are created using the Torgegram function. A Torgegram object stores information used to construct an empirical semivariogram based on hydrologic distance. The plot.Torgegram function allwos the results to be presented separately for flow-connected and flow-unconnected sites.

Usage

1
2
3
4
## S3 method for class 'Torgegram'
plot(x, sp.relationship = c("fc", "fu"), 
  min.cex = 1.5, max.cex = 6, leg.auto = TRUE, main = "", ylab = "",	
  xlab = "Stream Distance", ... )

Arguments

x

an object of class Torgegram

sp.relationship

a string or character vector representing the in-stream spatial relationship to be plotted. "fc" specifies plotting of only flow-connected, and "fu" specifies plotting of only flow-unconnected. Default is both.

min.cex

Minimum character expansion size of the plotting symbols. Symbols are scaled according to how many pairs of points went into computing each bin of the semivariogram. The bin with the smallest sample size will be be plotted with this symbol size. The default is 1.5.

max.cex

Maximum character expansion size of the plotting symbols. Symbols are scaled according to how many pairs of points went into computing each bin of the semivariogram. The bin with the largest sample size will be be plotted with this symbol size. The default is 6.

leg.auto

Logical, default to TRUE. Include a legend.

main

Title for plot

ylab

Label for y-axis

xlab

Label for x-axis

...

Other plotting arguments

Details

The Torgegram function creates a list of distances and empirical semivariogram values, along with number of pairs of points in each bin, for both flow-connected and flow-unconnected sites. Flow-connected locations lie on the same stream network (share a common downstream junction) and water flows from one location to the other. Flow-unconnected locations also lie on the same stream network, but do not share flow. The output is of class Torgegram. This is the default plotting method for this class.

Value

Plot of empirical semivariogram values

Author(s)

Jay Ver Hoef support@SpatialStreamNetworks.com

See Also

SpatialStreamNetwork-class, plot

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
library(SSN)
#for examples, copy MiddleFork04.ssn directory to R's temporary directory
copyLSN2temp()
# NOT RUN
# Create a SpatialStreamNetork object that also contains prediction sites
#mf04p <- importSSN(paste0(tempdir(),'/MiddleFork04.ssn'), 
#  predpts = "pred1km", o.write = TRUE)
#use mf04p SpatialStreamNetwork object, already created
data(mf04p)
#for examples only, make sure mf04p has the correct path
#if you use importSSN(), path will be correct
mf04p <- updatePath(mf04p, paste0(tempdir(),'/MiddleFork04.ssn'))

ESVF <- Torgegram(mf04p, "Summer_mn")
plot(ESVF)

ESVF <- Torgegram(mf04p, "Summer_mn", maxlag = 20000, nlag = 10)
plot(ESVF, sp.relationship = "fc", col = "red", main = "Flow-connected Torgegram")
plot(ESVF, sp.relationship = "fu", min.cex = .4, max.cex = 8,
     main = "Flow-unconnected Torgegram")
plot(ESVF, min.cex = .4, max.cex = 8, col = c("darkgray", "black"),
     main = "", xlab = "Stream Distance (m)")

# generate and plot an empirical semivariogram based on model residuals
data(modelFits)
#make sure fitSp has the correct path, will vary for each users installation
fitSp$ssn.object@path <- system.file("lsndata/MiddleFork04.ssn", package = "SSN")
resids <- residuals(fitSp)
names(resids$ssn.object)
ESVF <- Torgegram(resids, "_resid_", maxlag = 20000,
    nlag = 10)
plot(ESVF, xlim = c(0,10000))

SSN documentation built on March 13, 2020, 1:49 a.m.