Skip to content
Back to formatted view

Raw Message

Message-ID: <20080312172548.M44538@centroin.com.br>
Date: 2008-03-12T17:28:03Z
From: Alberto Monteiro
Subject: Specifying relative position of text in a plot
In-Reply-To: <16002549.post@talk.nabble.com>

Tom La Bone asked:
>
> What is the simplest way to specify the location of text in a 
> scatter plot
> (created using the plot function) in relative terms rather than 
> specific x-y coordinates? For example, rather than putting text at 
> (300,49) on a plot, how do I put it 1/10 of the way over from the y 
> axis and 1/2 of the way up from the x axis? Thanks.
> 
See the help of par:
?par

Namely:

plot(rnorm(100), rnorm(100))
pu <- par()$usr
x <- pu[1] * 0.5 + pu[2] * 0.5
y <- pu[3] * 0.1 + pu[4] * 0.9
text(x, y, "the quick brown fox jumps over a lazy dog")

Alberto Monteiro