You're right, I meant to write "lines"not "line". The strange thing is, although "line" isn't listed in ?unit, it doesn't return an error on my machine,

> unit(-1, "line")
[1] -1line
> unit(-1, "lines")
[1] -1lines

Reading from http://svn.r-project.org/R/trunk/src/library/grid/src/unit.c "line" is listed as a pseudonym, so I guess it is a valid unit after all.

sessionInfo()
R version 2.9.0 (2009-04-17)
i386-apple-darwin8.11.1

locale:
en_GB.UTF-8/en_GB.UTF-8/C/C/en_GB.UTF-8/en_GB.UTF-8

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


Best,

baptiste





David Winsemius wrote:

On Jun 24, 2009, at 1:21 AM, casperyc wrote:


[quote]>  grid.text("t", x=0.3, y=unit(-1, "line"), vp=vp2)
Error in valid.units(units) : Invalid unit
grid.text("s", 0.8, unit(-1, "line"), gp=gpar(col="red"), vp=vp2)
Error in valid.units(units) : Invalid unit[/quote]

Hi,

I have loaded the [grid] package. It seems that I have to load another
package?

No. Such a need might have been suggested by a function not found error. In this case the details are in the help page for the unit function in grid. The unit parameter was mis-specified.

?unit

Try:

 grid.text("t", x=0.3, y=unit(-1, "lines"), vp=vp2)
--
 grid.text("s", 0.8, unit(-1, "lines"), gp=gpar(col="red"), vp=vp2)


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



--
_____________________________

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

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to