Skip to content

Instantly share code, notes, and snippets.

@glamp
Created June 25, 2013 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glamp/5862323 to your computer and use it in GitHub Desktop.
Save glamp/5862323 to your computer and use it in GitHub Desktop.
x <- rnorm(100)
x.mean <- mean(x)
x.sd <- sd(x)
bands <- sapply(seq(-3, 3), function(i) {i * rep(x.sd, 100) })
cols <- c("red", "orange", "gold", "green", "gold", "orange", "red")
plot(x, ylim=c(-3.5, 3.5), type="l", lty=2, main="Western Eletric Rules")
for (i in 1:7) {
lines(x.mean + bands[,i], col=cols[i], lwd=2, lty=2)
# there is no Zone 0
if (i!=4) {
text(50, x.mean + bands[1,ifelse(i > 4, i-1, i)] + 0.5, paste("Zone", i-4),cex=1.5)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment