[R] lattice, Hmisc: vertical placement of superpose.symbol in Dotplot()

John G. Bullock john.bullock at aya.yale.edu
Fri Jul 3 16:02:59 CEST 2009


I often use Dotplot() from the Hmisc package to construct dotplots.
Typically, I plot multiple symbols on each line of a dotplot.
Sometimes these symbols overlap.  In these cases, I would like to
eliminate the overlap by slightly adjusting the vertical placement
of the plotted symbols.  Is there a straightforward way to do this?

Here is code to illustrate the problem:

    library(Hmisc)

    test <- data.frame(   m=c(1, 1.01, 3, 5)
                       , lower=c(.5, .6, 2.5, 4.5)
                       , upper=c(1.5, 1.6, 3.5, 5.5)
                       , line=c('bottom', 'bottom', 'top', 'top')
                       , group=c('A', 'B', 'A', 'B'))                      

    my.Dotplot <- Dotplot(  line ~ Cbind(m, lower, upper)
                          , groups=group
                          , data=test
                          , pch=c('A', 'B')
                          , cex=c(1,1)
                          , col=c('black', 'black'))      

    print(my.Dotplot)


This produces a dotplot with two lines.  The top line is fine. 
On the bottom line, the plotted symbols overlap, making them
illegible.

superpose.symbol is the set of parameters that seem to control the
appearance of the plotted symbols.  But I don't see any way to
change the vertical placement of these symbols.  I also thought
that there might be a way to change the factor test$line to get
the result that I want, but if so, I don't see what it is.

Thank you,
--John




More information about the R-help mailing list