[R] Apparent different in symbol scaling between xyplot and grid.points

Sebastien Bihorel Sebastien.Bihorel at cognigencorp.com
Fri Dec 4 17:34:00 CET 2009


Dear R-users,

For the past few days, I have been trying to find the reason why some of 
my plots were showing symbols of different sizes, while I thought I was 
using the same .cex arguments everywhere. The problem is exemplified by 
the following example code where the xyplot and grid.points functions 
are used. The scaling factor is set to 0.84 in both the functions 
settings, but one can see that, in the pdf file, the blue symbols 
plotted by xyplot are smaller than the single black symbol created by 
grid.points. Playing with the trellis settings did not seem to solve the 
problem. I am missing a hidden scaling factor somewhere, but don't know 
where to look anymore

I would greatly appreciate the feedback of the list on this issue.

library(lattice)
library(grid)

pdf(file="test.pdf")

df <- data.frame(a=1:12,b=1:12,c=rep(1:4,each=3))

#trellis.par.set(superpose.symbol=list(cex=1))

xyplot(b~a|c,
       data=df,
       panel = function(x,y){
         panel.xyplot(x,y,pch=3,cex=0.84)}
       )

str(trellis.par.get())      
str(get.gpar()) 

grid.points(x=100,y=85,pch=3,gp=gpar(cex=0.84))

dev.off()




More information about the R-help mailing list