Skip to content
Prev 163746 / 398506 Next

Howto Add Labels Next To Markers in Scatter Plot

On 12/4/2008 12:59 AM, Gundala Viswanath wrote:
f <- "class true_hits false_hits species
big 2350 180 lion
big 375 20 dog
big 635 97 cow
big 78 4 horse
big 694 93 giraffe"

fdata <- read.table(textConnection(f), sep=" ", header=TRUE)

par(bg="red")

with(fdata, plot(true_hits, false_hits,
xlab="# True Hits", ylab="# False Hits"))

with(fdata, text(x=true_hits, y=false_hits, labels=species,
pos=c(2,4,2,4,4)))

?text
?identify