[R] Border width on symbols plotted with the lattice package

David Winsemius dwinsemius at comcast.net
Fri Feb 8 18:04:59 CET 2013


On Feb 8, 2013, at 5:46 AM, Karl Ove Hufthammer wrote:

> Dear list members,
> 
> I can't figure out how get 'xyplot' or 'dotplot' in the 'lattice' package to respect the 'lwd' value for specifying the border with for *symbols* (for lines it works fine). Example:
> 
> -----
> # Base graphics works fine (gives a 'fat’ circle)
> plot(5, cex=10, pch=21, lwd=10)
> 
> # But 'xyplot' or 'dotplot' doesn't
> library(lattice)
> xyplot(4:5~4:5, groups=4:5, par.settings = simpleTheme(cex=10, pch=21, lwd=5),
>        auto.key=TRUE)
> -----
> 
> For 'xyplot' or 'dotplot' the border stays thin no matter what I set 'lwd' to. However, the symbols shown in the *legend* has the 'lwd' correctly applied.
> 
> How can I fix this? Or is it simply a bug in the 'lattice' package?

The grid.points function can accept a lwd argument:

xyplot(4:5~4:5, groups=4:5, panel=function(x,y,groups,...){ 
       panel.xyplot(x,y,...,col='white')
        grid.points(x,y, gp=gpar(cex=10, lwd=7) )         },
        auto.key=TRUE)

This probably means there is a less hackish way of setting the lwd.points, but I don't find it in my sequesntial following through the lattice help pages.

-- 
David Winsemius
Alameda, CA, USA



More information about the R-help mailing list