亲爱的所有我有一个挑战,其中线图和点图必须在下面的格子包的XYPlot中组合是一个可重复的示例,并且绘图应该在PDF上取决于因素,例如:这里因子(f1)= 4所以应该b4 4 PDF中的页面[注意:此处因子是组数据]
`library(lattice)
d=data.frame(seq <- c(1,2,3,4,5,6,7,8,9,10),
n1 <- c(23 ,27 ,26, 24 ,27 ,28 ,28 ,29 ,30 ,31),
n2 <- c(31 ,30 ,25, 23 ,22 ,26 ,24 ,29 ,25 ,27),
c1 <- c(44 ,0 ,0, 44 ,44 ,0 ,0 ,0 ,44 ,0),
c2 <- c(48 ,0 ,0, 48 ,48 ,0 ,0 ,0 ,48 ,0),
c3 <- c(50 ,0 ,0, 50 ,50 ,0 ,0 ,0 ,50 ,0),
f1 <- c(1 ,1 ,1, 2 ,2 ,3 ,3 ,3 ,4 ,4))
names(d)<- c("Seq","n1","n2","c1","c2","c3")`
下面是RCode:用于组合线和点图
`xyplot(c1 + c2 + c3 ~ seq | as.factor(f1), data = d) +
xyplot(n1 + n2 ~ seq| as.factor(f1), data = d, type = "l") `
点击蓝色链接查看情节,每个情节应该在不同的pdf页面上 Here as we can Observer all group data is shown on one screen , Required it should created in diffrent pages as per pdf
创建该绘图代码的Pdf
`pdf('Report.pdf',width = 35 ,height = 20)
print(xyplot(n1 + n2 + c1 + c2 + c3 ~ time | factor(f1), data=v1, pch=19,grid=TRUE,main="Time Series Analysis", xlab="Time",
lab="Y -axis",layout=c(1,1),points=TRUE,size = 50,fill="transparent"))
dev.off()`
当我们想要绘制point plot
或line plot
(其中一个)时,此代码是成功的但是在我们的情况下情况不同。我们想要线图和点,并且有两种不同的xyplot语法。现在查询是如何在每个页面中按因子方式创建每个绘图,以便它可以用pdf格式编写,如上面的代码所示