plotSD: Plot sampling designs and related cost maps

Description Usage Arguments Value Author(s) Examples

View source: R/plotSD.R

Description

Given a sampling design and a function to compute cost maps it generates the related map plot, based on spplot. If no cost map function is available, it may plot it with data from related simulations.

Usage

1
2
3
4
5
6
7
8
9
plotSD(simulations, SD,
  locationsFix = integer(0), 
  locationsInitial = integer(0), 
  locationsAll = integer(0),
  costMap,
  zcol = 1, allIn1Plot = 0,
  pch = c(1, 20, 4), col = c("white", "white", "white", "white"), 
  pointsKey = TRUE, mainCost = TRUE,
  pch.SDs, col.SDs, cex.SDs, ...)

Arguments

simulations

Simulations object

SD

indices of locations of sensors, can be a matrix (rows refer to SDs) or a list

locationsFix

indices of fix sensors, taken into account to compute cost map and plotted

locationsInitial

indices of initial sensors, for plotting

locationsAll

indices of all possible sensors, for plotting

costMap

function to compute the values for the background map; needs the parameters simulations and locations; output must be a list with "costLocations" of length like the locations of simulations

zcol

index or name: if no costMap given, this layer of the locations is used as background map

allIn1Plot

if several SDs are given, they are by default (allIn1Plot = 0) plotted each on a map; if allIn1Plot is an integer, all SDs are combined in one plot with the cost map of this SD as background

pch

point style of SD, locationsFix, locationsInitial; for locationsAll the pch = "." cannot be changed

col

colors for SD, locationsFix, locationsInitial, locationsAll

pointsKey

logical, if key for points is to be printed

mainCost

logical, if cost of SD is to be used as main (this is only done if costMap returns a list item "cost")

pch.SDs

point types for the different SDs, must have length that fits number of SDs (default: use pch[1] for all SDs but vary size)

col.SDs

point colours for different SDs

cex.SDs

point size for different SDs

...

further parameters to be forwarded to spplot

Value

The function generates plots (main and point key missing) and returns a list of trellis objects (including main and keys).

Author(s)

Kristina B. Helle, kristina.helle@uni-muenster.de

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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
demo(radioactivePlumes_addProperties) 
data(SDssa)
SDs = list(SDssa[["SD"]][[1]][1,], SDssa$report[["SD_final"]])
singleDet = replaceDefault(singleDetection, 
  newDefaults = list(plot = TRUE), type = "costFun.optimiseSD")[[1]]
# separate maps
plotSD1a = plotSD(
  simulations = radioactivePlumes,
  SD = SDs,
  costMap = singleDet)
for (i in seq(along = SDs)){
  plot(plotSD1a[[i]])
}
  
# combined map (with customised parameters for fix and initial sensors)
I = nLocations(radioactivePlumes)
set.seed(22347287) # reconstruct initial and fix sensors of SDssa
locDel3 = sample.int(I, 5)
locKeep3 = sample(setdiff(1:I, locDel3), 10)
locAll3 = c(sample(setdiff(1:I, 
  c(locDel3, locKeep3)), 10), locDel3)

plotSD2 = plotSD(
  simulations = radioactivePlumes,
  SD = SDs,
  locationsAll = setdiff(1:nLocations(radioactivePlumes), c(locKeep3, locAll3)),
  locationsFix = locKeep3,
  locationsInitial = locDel3,
  costMap = singleDet,
  allIn1Plot = 2,
  col = c("green", "blue", "red", "white"),
  pch = c(1,2,4),
  col.regions = grey.colors,
  colorkey = FALSE)  


# combined map (with customised parameters for different SDs)   
plotSD3 = plotSD(
  simulations = radioactivePlumes,
  SD = SDs,
  locationsFix = locKeep3,
  locationsAll = setdiff(1:nLocations(radioactivePlumes), c(locKeep3, locAll3)), 
  allIn1Plot = 2,
  col = c(1, "white", "white", "white"),
  pch = c(1,20,0),
  col.regions = grey.colors,
  pointsKey = FALSE,
  pch.SDs = 2:5,
  cex.SDs = c(3.5,3,2.5,2),
  col.SDs = 4:8
  )  

sensors4plumes documentation built on May 1, 2019, 10:27 p.m.