看看ggplot2
#create dummy data
n <- 200
dataset <- data.frame(xval = runif(n), col1 = rnorm(n), col2 = rnorm(n, sd = 2), col3 = rnorm(n, mean = seq(0, 2, length = n)), col4 = rnorm(n, sd = seq(0, 1, length = n)), col5 = rnorm(n, mean = 1))
#convert data to long format
library(reshape)
Molten <- melt(dataset, id.vars = "xval")
#plot it
library(ggplot2)
ggplot(Molten, aes(x = xval, y = value, colour = variable)) +
geom_smooth() + geom_point()
#some tweaking
ggplot(Molten, aes(x = xval, y = value, colour = variable)) +
geom_smooth(se = FALSE) + geom_point() + theme_bw() +
scale_x_continuous("the x label") + scale_x_continuous("the y label") +
scale_colour_discrete("")
