I was wondering if there is a simple way to add text labels with a contrasting background to an R plot using the base graphic system. Until now I have always used the rect
Quick hack using altcode character for a box:
plot(x=runif(1000), y=runif(1000),
type="p", pch=16, col="#40404050")
labels <- c("some text", "something else")
boxes <- sapply(nchar(labels), function(n)
paste(rep("█", n), collapse=""))
pos <- rbind(c(0.2, .1), c(.5, .5))
text(pos, labels=boxes, col="#CCCCCC99")
text(pos, labels=labels)