[R] multiple xyplots on the same graph
S. Swaminathan
sswami at hotmail.com
Thu Sep 28 23:53:33 CEST 2006
I am new to R and am having trouble plotting multiple xyplots on the same
graph.
I have a dataframe x1 with 3 columns month, var1, var2. Month is a factor
while var1 and var2 are numeric.
Reading through the archives I learned to plot var1 vs month and var2 vs
month and have them as two plots in one window by doing the following
library(lattice)
x<-xyplot(var1~month,type="b")
y<-xyplot(var2~month,type="b")
print(x,split(c(1,1,1,2),more=TRUE)
print(y,split(c(1,2,1,2))
How do I get just one plot with month as the x axis and two lines for var1
and var2 ?
thanks
swami
More information about the R-help
mailing list