2013-10-22 7 views
10

Cercando di capire come aggiungere punti o serie di dati a un reticolo di reticolo esistente una volta creato. Questo ha qualcosa a che fare con plot.points e/o la funzione di aggiornamento?Unione o sovrapposizione di xyplots in un pannello reticolare

# 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" 

Nota: in questo esempio, entrambe le trame "a" e "b" provengono dalle originali iride dataframe, ma idealmente, la soluzione sarebbe lavorare con dataframes distinte.

Qualche idea? Grazie!
Bryan

risposta

Problemi correlati