hexbin()
and smoothScatter()
set.seed(123)
100
N <- rnorm(N, 100, 15)
x <- 0.3*x + rnorm(N, 0, 5)
y <-plot(x, y)
plot(x, y, main="Customized scatter plot", xlim=c(50, 150), ylim=c(10, 50),
xlab="x axis", ylab="y axis", pch=16, col="darkgray")
plot(y, main="Univeriate scatter plot", ylim=c(10, 50),
xlab="Index", ylab="y axis", pch=4, lwd=2, col="blue")
cbind(x, y)
xy <-plot(xy)
plot(y ~ x)
# not shown
Useful if one variable can take on only a few values, and one plot symbol represents many observations.
sample(0:5, N, replace=TRUE)
z <-plot(z ~ x, pch=1, col="red", cex=1.5, main="Scatter plot")
plot(jitter(z) ~ x, pch=1, col="red", cex=1.5,
main="Scatter plot with jittered y-coordinate")
plot()
rnorm(10)
vec <-plot(vec, type="p", xlab=NA, main="type p", cex=1.5)
plot(vec, type="l", xlab=NA, main="type l", cex=1.5)
plot(vec, type="b", xlab=NA, main="type b", cex=1.5)
plot(vec, type="o", xlab=NA, main="type o", cex=1.5)
plot(vec, type="s", xlab=NA, main="type s", cex=1.5)
plot(vec, type="h", xlab=NA, main="type h", cex=1.5)
seq(from=-2*pi, to=2*pi, length.out=50)
vec <- cbind(2*sin(vec), sin(vec-(pi/4)), 0.5*sin(vec-(pi/2)))
mat <-matplot(vec, mat, type="b", xlab=NA, ylab=NA, pch=1:3, main="Sine-curves")
plot(vec)
identify(vec)
R markdown - markdown - R code - all posts