Text labels with background colour in R
问题 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() function together with graphics::strheight() and graphics::strwidth() to separately create the background box on which I then place my text using text() : # Prepare a noisy background: plot(x = runif(1000), y = runif(1000), type = "p", pch = 16, col = "#40404050") ## Parameters for my text: myText <- "some Text"