The R Project SVN R

Rev

Rev 61153 | Rev 64662 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 61153 Rev 61168
Line 71... Line 71...
71
  \code{\link{scatter.smooth}} adds a \code{\link{loess}}
71
  \code{\link{scatter.smooth}} adds a \code{\link{loess}}
72
  regression smoother to a scatter plot.
72
  regression smoother to a scatter plot.
73
}
73
}
74
\author{Florian Hahne at FHCRC, originally}
74
\author{Florian Hahne at FHCRC, originally}
75
\examples{
75
\examples{
76
  ## A largish data set
76
## A largish data set
77
  n <- 10000
77
n <- 10000
78
  x1  <- matrix(rnorm(n), ncol = 2)
78
x1  <- matrix(rnorm(n), ncol = 2)
79
  x2  <- matrix(rnorm(n, mean = 3, sd = 1.5), ncol = 2)
79
x2  <- matrix(rnorm(n, mean = 3, sd = 1.5), ncol = 2)
80
  x   <- rbind(x1,x2)
80
x   <- rbind(x1, x2)
81
 
81
 
82
  oldpar <- par(mfrow = c(2,2))
82
oldpar <- par(mfrow = c(2, 2))
83
  smoothScatter(x, nrpoints = 0)
83
smoothScatter(x, nrpoints = 0)
84
  smoothScatter(x)
84
smoothScatter(x)
85
 
85
 
86
  ## a different color scheme:
86
## a different color scheme:
87
  Lab.palette <-
-
 
88
      colorRampPalette(c("blue", "orange", "red"), space = "Lab")
87
Lab.palette <- colorRampPalette(c("blue", "orange", "red"), space = "Lab")
89
  smoothScatter(x, colramp = Lab.palette)
88
smoothScatter(x, colramp = Lab.palette)
90
 
89
 
91
  ## somewhat similar, using identical smoothing computations,
90
## somewhat similar, using identical smoothing computations,
92
  ## but considerably *less* efficient for really large data:
91
## but considerably *less* efficient for really large data:
93
  plot(x, col = densCols(x), pch = 20)
92
plot(x, col = densCols(x), pch = 20)
94
 
93
 
95
  ## use with pairs:
94
## use with pairs:
96
  par(mfrow = c(1,1))
95
par(mfrow = c(1, 1))
97
  y <- matrix(rnorm(40000), ncol = 4) + 3*rnorm(10000)
96
y <- matrix(rnorm(40000), ncol = 4) + 3*rnorm(10000)
98
  y[, c(2,4)] <-  -y[, c(2,4)]
97
y[, c(2,4)] <-  -y[, c(2,4)]
99
  pairs(y, panel = function(...) smoothScatter(..., nrpoints = 0, add = TRUE))
98
pairs(y, panel = function(...) smoothScatter(..., nrpoints = 0, add = TRUE))
100
 
99
 
101
  par(oldpar)
100
par(oldpar)
102
}
101
}
103
\keyword{hplot}
102
\keyword{hplot}