试图弄清楚如何在创建现有格子面板后向其添加点或数据系列。这与 plot.points 和/或更新功能有关吗?
# Initialize first plot
library(lattice)
a <- xyplot(Sepal.Length~Sepal.Width, groups=Species, data=iris
, subset=Species %in% levels(Species)[1:2])
print(a)
# Create second plot to overlay or merge with the first plot
b <- xyplot(Sepal.Length~Sepal.Width, groups=Species, data=iris
, subset=Species %in% levels(Species)[3])
# Initial attempt at merging plots:
library(latticeExtra)
print(c(a,b)) # this displays the data in an adjacent second panel
print(c(a,b,layout=c(1,1))) # and this only shows series "b"
注意:在此示例中,图“a”和“b”均来自原始iris数据帧,但理想情况下,该解决方案适用于不同的数据帧。
有任何想法吗?谢谢!
布莱恩