[R] high density plots using lattice dotplot()

Duncan Mackay
Mon, 20 Apr 2015 23:35:14 -0000

Hi Luigi

Strips take up space so if you are willing to not have strip and put the
strip values within the plot area then

      xyplot(y ~ x|cond.factor, data = ...,
             as.table = T,
             groups   = ...,
             layout   = ...,
             drop.unused = T,
             par.settings = list(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,
             scales   = list(x = list(alternating = 2),
                             y = list(alternating = FALSE)
                             ),
             type = "p",
             panel = function(x,y, subscripts, groups,...){
                                panel.superpose(x,y,subscripts,groups,...,
col = ...)
                                panel.text(x,y,...,cex = 0.6)
                            }
      )

if the text values are a vector
      stext = ...
      xyplot(y ~ x|cond.factor, data = ...,
             as.table = T,
             groups   = ...,
             layout   = ...,
             drop.unused = T,
             par.settings = list(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,
             scales   = list(x = list(alternating = 2),
                             y = list(alternating = FALSE)
                             ),
             type = "p",
             panel = function(x,y, subscripts, groups,...){
                               pnl = panel.number()
                                panel.superpose(x,y,subscripts,groups,...,
col = ...)
                                panel.text(x,y,stext[pnl],cex = 0.6)
                            }
      )

you could also you group.number instead of pnl if it is needed elsewhere.
text position could be done in a similar fashion if needed to be in
different places for some panels.

If you require the strip then an additional par.settings is
layout.heights = list(strip = 0.8)
or even untested in this situation
strip = FALSE
strip.left  = TRUE

Regards

Duncan

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mackay at northnet.com.au

-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Luigi
Marongiu
Sent: Sunday, 19 April 2015 19:28
To: r-help
Subject: [R] high density plots using lattice dotplot()

Dear all,
I am trying to plot the results of a PCR experiments that involves 384
individual plots. Admittedly the space for the plots will be tiny, but
I just nedd some icon to have a feeling of the layout of the
experiment and a quick comparison of the plots.
I believe that lattice would be the right tool, but when I tried to
implement i got an error. Specifically the output would be a A4 pdf,
so with about 600 cm2 of drawing space, which gives about 1.5 cm2 for
each plot; removing the labels that might just work.
So I have the y values = 'fluorescence', x 'values' = cycles and
384
'well' data. I implemented to begin with:

xyplot(fluorescence ~ cycles | well,
         ylab="Fluorescence",
         xlab="Cycles",
         main=list(draw = FALSE),
         scales = list(
           x = list(draw = FALSE),
           y = list(draw = FALSE),
           relation="same",
           alternating=TRUE),
         layout = c(24,16),
         par.settings = list(strip.background=list(col="white")),
         pch = "."
  )

but the  the individual graphs show only the writing "data" instead of
the actual plots.
How can I overcome this error?
Thank you
Best regards
Luigi

______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.