Skip to content

Instantly share code, notes, and snippets.

@kzfm
Created June 22, 2013 07:40
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 kzfm/5836232 to your computer and use it in GitHub Desktop.
Save kzfm/5836232 to your computer and use it in GitHub Desktop.
mt
gx <- function(x){
x[-2>x | x>2] <-NA
1/2*cos(6*x)+7/2
}
fx <- function(x){
x[x<(-1)] <- NA
x[x>1] <- NA
x^4-x^2+6
}
sx <- function(x){
x[-1<x & x<1] <-NA
12/(abs(x)+1)
}
ggplot(data.frame(x=c(-7,7),y=0), aes(x,y))+stat_function(fun=gx) +stat_function(fun=fx)+stat_function(fun=sx)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment