Learn R Programming

NetOrigin (version 1.1-6)

plot_performance: A plot method combining a time series of performance results.

Description

A plot method combining a time series of performance results.

Usage

plot_performance(
  x,
  var = "rank",
  add = FALSE,
  offset = NULL,
  log = FALSE,
  col = 1,
  ylim = NULL,
  text.padding = 0.9,
  ...
)

Arguments

x

data.frame obtained by combined results from performance.origin with variables X1 for time point, start for true origin, est for estimated origin, and performance variables

var

character, variable to be plotted, performance.origin returns rank, spj, and dist, default is 'rank'

add

logical, should be added to another performance plot

offset

POSIXct, starting time of spreading

log

logical, should y-axis be logarithmized?

col

numeric or character, color of lines

ylim

numeric vector, range of y axis

text.padding

a numeric value specifying the factor for the text position relative to the y values

...

further graphical parameters passed to default plot function

Examples

Run this code
if (FALSE) { 
### delays on Goettingen bus network
# compute effective distance
data(ptnGoe)
goenet <- igraph::as_adjacency_matrix(ptnGoe, sparse=FALSE)
p <- goenet/rowSums(goenet)
eff <- eff_dist(p)
# apply source estimation
data(delayGoe)
if (requireNamespace("aplyr", quietly = TRUE)) {
   res <- alply(.data=delayGoe[11:20,-c(1:2)], .margins=1, .fun=origin_edm, 
                distance=eff, silent=TRUE, .progress='text')
   perfGoe <- ldply(Map(performance, x = res, start = 2, list(graph = ptnGoe)))
   # performance plots
   plot_performance(perfGoe, var='rank', ylab='rank of correct detection', text.padding=0.5)
   plot_performance(perfGoe, var='dist', ylab='distance to correct detection')
}

### delays on Athens metro network
# compute effective distance
data(ptnAth)
athnet <- igraph::as_adjacency_matrix(ptnAth, sparse=FALSE)
p <- athnet/rowSums(athnet)
eff <- eff_dist(p)
# apply source estimation
data(delayAth)
if (requireNamespace("aplyr", quietly = TRUE)) {
   res <- alply(.data=delayAth[11:20,-c(1:2)], .margins=1, .fun=origin_edm, 
             distance=eff, silent=TRUE, .progress='text')
   perfAth <- ldply(Map(performance, x = res, start = as.list(delayAth$k0),
                     list(graph = ptnAth)))
   # performance plots
   plot_performance(perfAth, var='rank', ylab='rank of correct detection',text.padding=0.5)
   plot_performance(perfAth, var='dist', ylab='distance to correct detection')
}
}

Run the code above in your browser using DataLab