thin: Sampling for qq plots

Description Usage Examples

Description

Returns k indices between 1:max.idx (x) such that -log(x/n) is uniformly distributed. This is useful to reduce overplotting when plotting log-transformed uniform data (such as p-values in a qq plot).

Usage

1
thin(n, k = 2000, max.idx = n)

Examples

1
2
3
4
5
6
n <- 1e5
x <- sort(runif(n))
thin.idx <- thin(n, 500)
par(mfcol=c(1, 2))
plot(-log10(1:n/n), -log10(x), ann=FALSE)
plot(-log10(thin.idx/n), -log10(x[thin.idx]), ann=FALSE)

sushilashenoy/zoom.plot documentation built on May 30, 2019, 8:42 p.m.