[R] Adding text to page margin with lattice graphics

Dennis Fisher fisher at plessthan.com
Thu Apr 7 18:18:53 CEST 2011


R: 2.12.1
OS X

Colleagues

I am working with lattice graphics for the first time and I am confused by some aspects of controlling these graphics.  The most pressing issue is the following:

I can print the graphics without problems with the command:
	print(MYFUNCTION(SOMEOBJECT)
However, I would like to add margin text (this terminology might not apply in this setting).  I am able to do so with the following command:
	print(MYFUNCTION(SOMEOBJECT, page=function(page) grid.text("SOMETEXT", x=0.5, y=0.01)))

Two issues:
1.  The added text overlaps text in SOMEOBJECT.  How do I reserve space at the margins of the page in which I can print the added text? (the equivalent of par(mar=c(1,1,1,1)))

2.  I was able to construct the command with some assistance from a colleague.  But, I remain at a loss to understand the syntax:
	page=function(page), 
	i.e., page is a function of itself?
Any help in interpreting the function would be appreciated.

Dennis

Dennis Fisher MD
P < (The "P Less Than" Company)
Phone: 1-866-PLessThan (1-866-753-7784)
Fax: 1-866-PLessThan (1-866-753-7784)
www.PLessThan.com



More information about the R-help mailing list