2013-10-22 57 views
10

試圖找出在創建點時如何將點或數據序列添加到現有的格子面板。這是否與plot.points和/或更新功能有關?在格子面板中合併或重疊xyplots

# 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」來自原始虹膜數據幀,但理想的解決方案將具有鮮明的dataframes工作。

任何想法? 謝謝!
Bryan

回答