plot.knox: Plots a Heat Map of Near Repeat results based on p-values

Description Usage Arguments Value Examples

View source: R/plot_function.R

Description

Plots a Heat Map of Near Repeat results based on p-values

Usage

1
2
3
4
5
6
7
## S3 method for class 'knox'
plot(
  knox_object,
  pvalue_range = c(0, 0.05),
  text = "knox_ratio",
  minimum_perc = 20
)

Arguments

knox_object

a knox object, i.e. the result of a 'NearRepeat()' funtion call

pvalue_range

the range of p-values that will be colored as "significant", default = c(0, .05)

text

labels of cells, default is "knox_ratio". Possible values are "observed", "knox_ratio", "knox_ratio_median", "pvalues", or NA

minimum_perc

The minimum percentage of increased Knox value that will be highlighted. Default is 20 of Ratcliffe (2009). If parameter text equals "pvalues" or NA, the p-values alone determine highlighting, irrespective of the Knox (median) ratios.

Value

a heat map based on p-values (generated by ggplot2)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Generate example data. Suppose x and y refer to meters distance.
set.seed(10)
(mydata <- data.frame(x = sample(x = 20, size = 20, replace = TRUE) * 20,
                     y = sample(x = 20, size = 20, replace = TRUE) * 20,
                     date = as.Date(sort(sample(20, size = 20, replace = TRUE)),
                     origin = "2018-01-01")
                     ))

# The plot() function can be used to plot a Heat Map of Near Repeat results based on p-values
set.seed(4622)
myoutput <- NearRepeat(x = mydata$x, y = mydata$y, time = mydata$date,
                       sds = c(0,100,200,300,400), td = c(0,1,2,3,4,5))
plot(myoutput)

# The default range of p-values that will be highlighted (0-.05) can be adjusted using
# the 'pvalue_range' parameter. By default the Knox ratios are printed in the cells,
# but this can be adjusted using the 'text' parameter. The default is "knox_ratio".
# Possible values are "observed", "knox_ratio", "knox_ratio_median", "pvalues", or NA.
# For more information, see vignette("NearRepeat")

plot(myoutput, pvalue_range = c(0, .1), text = "observed")
plot(myoutput, pvalue_range = c(0, .1), text = "pvalues")

wsteenbeek/NearRepeat documentation built on Oct. 13, 2020, 9:49 a.m.