Skip to content
Prev 386119 / 398513 Next

R for-loop to add layer to lattice plot

On Tue, Oct 27, 2020 at 6:04 PM Luigi Marongiu <marongiu.luigi at gmail.com> wrote:
Yes, as Mark says, you need to change the last part to something like

P = xyplot(y ~ x, group = z, data = df, pch = 16, cex = 1.5, alpha = 0.25)
for (i in 1:length(plot_list)) {
  print(i)
  P = P + as.layer(plot_list[[i]])
}
plot(P)

-Deepayan