Skip to content

high density plots using lattice dotplot()

1 message · Duncan Mackay

#
Hi Luigi

I should have made up an example to make things easier when I replied today

This should get you going

set.seed(1)

PLATE <-
data.frame(Delta.Rn = rnorm(500),
           Cycle = rnorm(500),
           Well  = rep(1:50, each = 10))
head(PLATE)

xyplot(Delta.Rn ~ Cycle | Well,
         data = PLATE,
         groups = Well,
         ylab="Fluorescence (Delta Rn)",
         xlab="Cycles",
         main="TITLE",
         scales = list(
           x = list(draw = FALSE),
           y = list(draw = FALSE),
           relation="same",
           alternating=TRUE),
         as.table = TRUE,
         layout = c(10,5),
         par.settings = list(
           strip.background=list(col="white"),
           # layout.heights = list(strip = 0.8),
           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(pch = ".", cex = 2)
         ),
         strip    = FALSE,
         type = "p",
         col = 1,
         panel = panel.superpose,
         panel.groups = function(x,y,...,group.number){

                   panel.xyplot(x,y,... )

                   # text argument can be a vector of values not
                   # necessarily the group name
                   grid.text(c(LETTERS,letters)[group.number],
                             y = 0.93, x = 0.5,
                             default.units = "npc",
                             just = c("left", "bottom"),
                             gp = gpar(fontsize = 7) )

         }
  )

You could use panel.text instead of grid.text
Duncan

-----Original Message-----
From: Luigi Marongiu [mailto:marongiu.luigi at gmail.com] 
Sent: Wednesday, 22 April 2015 08:24
To: Duncan Mackay
Subject: Re: [R] high density plots using lattice dotplot()

Dear Duncan,
thank you for your reply. I tried to implement your suggestions but as
is on your reply did not work (actually R crashed) and a slight
elaboration returned the figure attached, which is essentially still
displaying text and not drawing the data. Here is what I wrote:
xyplot(Delta.Rn ~ Cycle | Well,
         data = PLATE,
         ylab="Fluorescence (Delta Rn)",
         xlab="Cycles",
         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),
           superpose.symbol = list(pch = ".", cex = 2)
         ),
         strip    = FALSE,
         type = "p",
         layout.heights = list(strip = 0.8),
         panel = function(x,y, subscripts, groups,...){
           panel.superpose(x,y,subscripts,groups,...,
                           col = ...)
           panel.text(x,y,...,cex = 0.6)
         }
  )


How can I improve the script?
Many thanks
Luigi
On Tue, Apr 21, 2015 at 12:35 AM, Duncan Mackay <dulcalma at bigpond.com> wrote: