Thanks Baptiste,
I think you nailed it.
baptiste auguie wrote:
Hi,
I think the size mismatch occurs because of a different default for
the fontsize (and grid.points has a size of 1 character by default).
Compare the following two examples,
# default
grid.newpage()
pushViewport(viewport(x=unit(0.5, "npc"), y=unit(0.5, "npc")))
lplot.xy(data.frame(x=0.55,y=0.5),type="p", pch=3)
grid.points(x=0.45,y=0.5, pch=3, gp=gpar(col="red"))
trellis.par.set("fontsize", list(points=12))
grid.newpage()
pushViewport(viewport(x=unit(0.5, "npc"), y=unit(0.5, "npc")))
lplot.xy(data.frame(x=0.55,y=0.5),type="p", pch=3)
grid.points(x=0.45,y=0.5, pch=3, gp=gpar(col="red"))
HTH,
baptiste
2009/12/4 Sebastien Bihorel <sebastien.biho...@cognigencorp.com>:
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()
______________________________________________
R-help@r-project.org mailing list
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.
______________________________________________
R-help@r-project.org mailing list
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.