[R] Positioning text in top left corner of plot

Benno Pütz puetz at mpipsykl.mpg.de
Tue Feb 7 15:17:06 CET 2012


Both are described in the documentation (?(m)text works for me):

Usage

mtext(text, side = 3, line = 0, outer = FALSE, at = NA,
      adj = NA, padj = NA, cex = NA, col = NA, font = NA, ...)

Arguments


text		a character or expression vector specifying the text to be written. Other objects are coerced by as.graphicsAnnot.
side		on which side of the plot (1=bottom, 2=left, 3=top, 4=right).
line		on which MARgin line, starting at 0 counting outwards.
[…]

actually, line does accept fractional values , e.g. line=.5 should work for you 

and 

Usage

text(x, ...)

## Default S3 method:
 text(x, y = NULL, labels = seq_along(x), adj = NULL,
     pos = NULL, offset = 0.5, vfont = NULL,
     cex = 1, col = NULL, font = NULL, ...)

Arguments

x, y		numeric vectors of coordinates where the text labels should be written. If the length of x and y differs, the shorter one is recycled.
labels	a character vector or expression specifying the text to be written. An attempt is made to coerce other language objects (names and calls) to expressions, and
		vectors and other classed objects to character vectors by as.character. If labels is longer than x and y, the coordinates are recycled to the length of labels.
adj		one or two values in [0, 1] which specify the x (and optionally y) adjustment of the labels. On most devices values outside that interval will also work.
[…]

Hope the formatting comes out OK…

	Benno

On Feb 7, 2012, at 2:49 PM, Manta wrote:

> Thanks, although I still have a couple of questions:
> 
> 1. What is the line parameter? I could not find it in the manual...
> 
> 2. How does exactly work the adj parameter when giving two different values?
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Positioning-text-in-top-left-corner-of-plot-tp831723p4364757.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at 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.
> 

Benno Pütz
Statistical Genetics
MPI of Psychiatry
Kraepelinstr. 2-10
80804 Munich, Germany
T: ++49-(0)89-306 22 222
F: ++49-(0)89-306 22 601



More information about the R-help mailing list