[R] create function to plot high density data using lattice

Luigi Marongiu marongiu.luigi at gmail.com
Thu Apr 23 14:50:01 CEST 2015


Dear all,
with the most useful help of Duncan I updated a script to plot high
density data in the form of 384 squares containing tiny plots. The
function works and it is possible to create a pdf version of the
output. but when i try to make a function out of this script, the
resulting pdf file is empty.
Any tips?
Thank you and best regards,
Luigi


 >>> here is the example:


DF <-  data.frame(Y = rnorm(17280),
             X = rnorm(1:45),
             Y2 = rnorm(17280)+2,
             Z  = 1:384)
plot.layout <- function(DF) {

# this works from here...
pdf(
  file = "TITLE-amp outlook.pdf",
  width = 15,
  height = 11,
  onefile = TRUE,
  family = "Helvetica",
  paper = "a4r"
)
xyplot(Y ~ X | Z,
       data = DF,
       groups = Z,
       allow.multiple = TRUE,
       ylab= "Y VALUES",
       xlab="X VALUES",
       main="TITLE",
       scales = list(
         x = list(draw = FALSE),
         y = list(draw = FALSE),
         relation="same",
         alternating=TRUE),
       as.table = TRUE,
       layout = c(24,16),
       par.settings = list(
         strip.background=list(col="white"),
         axis.text = list(cex = 0.6),
         par.xlab.text = list(cex = 0.75),
         par.ylab.text = list(cex = 0.75),
         par.main.text = list(cex = 0.8),
         superpose.symbol = list(type = "l", cex = 1)
       ),
       strip    = FALSE,
       type = "l",
       col = 3,
       panel = panel.superpose
)
dev.off()
#... till here

}
plot.layout(DF)



More information about the R-help mailing list