Hi R-devel,
It seems that grobX and grobY (from the grid package) do not refer to
the bounding box of a grid.points object.
library(grid)
library(lattice)
xyplot(1:10 ~ 1:10)
downViewport("plot1.panel.1.1.vp")
grob <- grid.get("GRID.points", grep=TRUE)
convertX(grobWidth(grob), "cm")
# 10.3430190058480cm
# (correct, but:)
convertX(grobX(grob, "west"), "cm")
# 5.89552083333333cm
convertX(grobX(grob, "east"), "cm")
# 5.89552083333334cm
So grobX is returning the midpoint, rather than the bounding box. This
is surprising, given that ?grobX says "If the grob describes multiple
shapes, in most cases, the boundary value will correspond to the edge
of a bounding box around all of the shapes."
The grobX() and grobY() calculations for "points" grobs is "imperfect"
because it treats the grob as a set of point locations and does NOT take
into account the size and shape of the actual data symbols. This means
that a points grob is not treated as multiple shapes, but in fact as a
single set of points. Hence, the calculations of the boundary for the
shape generate a convex hull around the point locations. In this case,
the points all lie along a straight line, so the convex hull is a long
thin "cigar" at a 45 degree angle. The calculation of points on this
boundary draws a line from the centre of the convex hull to the edge.
In this case, the line will intersect the convex hull boundary at the
centre of the set of points for all angles (apart from possibly 45
degrees).
If you want to work with the bounding box for the points, perhaps you
could draw an invisible rectangle based on the range of the data and
work off that, or just use convertX() on the range of the data (?)