size of point symbols
Dear all, Having received no answer in r-help I'm trying r-devel (hoping this is not a stupid question). I don't understand the rationale behind the absolute sizes of the point symbols, and I couldn't find it documented (I got lost in the C code graphics.c and gave up). The example below uses Grid to check the size of the symbols against a square of 10mm x 10mm.
checkOneSymbol <- function(pch=0){
gTree(children=gList(
rectGrob(0.5, 0.5, width=unit(10, "mm"), height=unit(10,
"mm"),
gp=gpar(lty=2, fill=NA, col=alpha("black", 0.5))),
pointsGrob(0.5, 0.5, size=unit(10, "mm"),pch=pch,
gp=gpar(col=alpha("red", 0.5)))
))
}
all.symbols <- lapply(0:23, checkOneSymbol)
pdf("symbols.pdf", height=1.2/2.54, width=24.2/2.54)
vp <- viewport(width=0.5, height=0.5, name="main")
pushViewport(vp)
pushViewport(viewport(layout=grid.layout(1, 24,
widths=unit(10, "mm"),
heights=unit(10, "mm"),
just="center")))
for(ii in 0:23){
pushViewport(viewport(layout.pos.col=ii+1, layout.pos.row=1))
grid.draw(all.symbols[[ii+1]])
upViewport(1)
}
dev.off()
What dictates the size of each symbol? (in other words, why is pch=21 a circle of radius given in inches, while pch=2 is a triangle of base length specified in mm and offset vertically?, etc.) I'm trying to develop a new symbol for the ggplot2 package where the size is to be accurately mapped onto the data either in linear size or area. I was expecting a similar idea behind the choice of base symbols. Is this documented? Best regards, baptiste _____________________________ Baptiste Augui? School of Physics University of Exeter Stocker Road, Exeter, Devon, EX4 4QL, UK Phone: +44 1392 264187 http://newton.ex.ac.uk/research/emag