[R] clipping viewports

Mikkel Grum mi2kelgrum at yahoo.com
Sun Sep 30 14:16:14 CEST 2007


Dear useRs,

Why are the rotated blue and yellow boxes in the example below clipped outside of 6 x 6 inch window in the middle of the page?? Where does the 6 x 6 inch window come from? I would like to make use of the entire page.

> library(grid)
> pdf(file = "FarmMaps.pdf", paper = "a4")
> pushViewport(viewport(
+    width = unit(7.6, "inches"), height = unit(11, "inches"), clip = "off"))
> grid.rect(gp = gpar(col = NA, fill = "grey"))
> pushViewport(viewport(x = unit(3.6, "inches"), y = unit(3.6, "inches"),
+    width = unit(3.6, "inches"), height = unit(3.6, "inches"), clip = "off",
+    angle = 76))
> grid.rect(gp = gpar(col = NA, fill = "blue"))
> upViewport()
> pushViewport(viewport(x = unit(1.8, "inches"), y = unit(7.6, "inches"),
+    width = unit(2.6, "inches"), height = unit(2.6, "inches"), clip = "off",
+    angle = -56))
> grid.rect(gp = gpar(col = NA, fill = "yellow"))
> 
> dev.off()
null device 
          1 
> 
> sessionInfo()
R version 2.5.1 (2007-06-27) 
i386-pc-mingw32 

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

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

Any assistance greatly appreciated,
Mikkel



       
____________________________________________________________________________________
Pinpoint customers who are looking for what you sell. 
http://searchmarketing.yahoo.com/



More information about the R-help mailing list