# scatter plot
x <- rnorm(25)
y <- rnorm(25)
# default scatterplot, x is not sorted so type set to "p"
color.plot(x, y)
# custom scatter plot
color.plot(x, y, col.point="darkred", col.fill="plum")
# function curve
x <- seq(10,500,by=1)
y <- 18/sqrt(x)
# default function plot, x is sorted so type set to "l"
color.plot(x, y)
# custom function plot
color.plot(x, y, ylab="My Y", , xlab="My X", col.line="blue",
col.bg="snow", col.area="slategray2", col.grid="lightsalmon")
# generate data randomly varying about a constant mean
y <- rnorm(25)
# default run chart
color.plot(y)
# customize run chart, pch=24: filled triangle point-up,
color.plot(y, lwd=2, col.point="sienna3", pch=24,
col.bg="mintcream", ylim=c(-3,3), center.line="median")
# generate steadily increasing values
y <- sort(rexp(50))
# default run chart
color.plot(y)
# run chart with border around plotted values
color.plot(y, col.area="transparent")
# time series chart, i.e., with dates, and filled area
# with option label for the x-axis
color.plot(y, x.start="2005/09/01", x.by="month", col.area="khaki",
xlab="Year")
# modern art
n <- sample(2:30, size=1)
x <- rnorm(n)
y <- rnorm(n)
clr <- colors()
color1 <- clr[sample(1:length(clr), size=1)]
color2 <- clr[sample(1:length(clr), size=1)]
color.plot(x, y, type="l", lty="dashed", lwd=3, col.area=color1,
col.line=color2, xy.ticks=FALSE, main="Modern Art",
cex.main=2, col.main="lightsteelblue")
Run the code above in your browser using DataLab