Here's one idea: df <- ...
# Create an empty plot big enough to fit all data points xlim <- range(df[,1], na.rm=TRUE) ylim <- range(df[,-1], na.rm=TRUE) plot(NA, xlim=xlim, ylim=ylim, xlab="x", ylab="y") # For each Y column, plot the data against the X column for (k in 2:ncol(df)) points(df[,1], df[,k], col=k-1) # Works with lines() too! and here is another one that assumes a scatter plot: xs <- rep(df[,1], times=ncol(df)-1) ys <- as.vector(as.matrix(df[,-1])) col <- rep(1:5, each=nrow(df)) plot(xs,ys, col=col, xlab="x", ylab="y") Hope that helps Henrik Bengtsson > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Hi from Zynnel > Sent: den 26 februari 2003 17:41 > To: [EMAIL PROTECTED] > Subject: [R] multiple plot overlay - dataframe > > > I hope you could help me with this. I have a dataframe > with 5 columns, the first column determining the X > values, and the rest four determining four separate Y > vectors. How can I plot them on the same graph, > overlaying each other? > Thanks. > > Elena Zheleva > > ______________________________________________ > [EMAIL PROTECTED] mailing list > http://www.stat.math.ethz.ch/mailman/listinfo/> r-help > > ______________________________________________ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
