[Rd] grobX for points?

Felix Andrews felix at nfrac.org
Fri Jul 25 17:19:40 CEST 2008


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."


> sessionInfo()
R version 2.7.1 (2008-06-23)
i386-pc-mingw32

locale:
LC_COLLATE=English_Australia.1252;LC_CTYPE=English_Australia.1252;LC_MONETARY=English_Australia.1252;LC_NUMERIC=C;LC_TIME=English_Australia.1252

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets
methods   base

other attached packages:
[1] playwith_0.9-10      cairoDevice_2.8      gWidgetsRGtk2_0.0-36
RGtk2_2.12.5-3       gWidgets_0.0-28
[6] lattice_0.17-10

loaded via a namespace (and not attached):
[1] gridBase_0.4-3 tools_2.7.1


-- 
Felix Andrews / 安福立
PhD candidate
Integrated Catchment Assessment and Management Centre
The Fenner School of Environment and Society
The Australian National University (Building 48A), ACT 0200
Beijing Bag, Locked Bag 40, Kingston ACT 2604
http://www.neurofractal.org/felix/
3358 543D AAC6 22C2 D336 80D9 360B 72DD 3E4C F5D8



More information about the R-devel mailing list