Search notes:

R function: text

X11()

x = c(0.9, 2.2, 2.9, 3.3, 3.8, 4.5, 5.1, 5.6, 6.2)
y = x^2

t = paste0(x, "^2 = ", y)

par(xpd=TRUE) # Enable text to be drawn outside the plot region.

margins_orig = as.numeric(unlist(par()['mar']))
margins_     = margins_orig+c(0, 0, 0.1, 2) # extend top by 0.1, right by 2 
par (mar = margins_)  
# par  (usr = c(min(x)-100, max(x)+10, min(y), max(y)+ 0.1))

plot(x, y, pch=19, col='red',
     bty='n'  # Suppres box around plot
#    xlim=c(min(x), max(x)),
#    ylim=c(min(y), max(y))
#    yaxp=c(
#      floor  (min(y)),
#      ceiling(max(y)),
#      5
#   )
)

text(x, y, t, col='blue', adj=c(-0.2, -0.2), cex=0.8)

axis(1, at=seq(floor(min(x)), ceiling(max(x)), 2))
axis(2, at=seq(floor(min(y)), ceiling(max(y)+5), 5))

z <- locator(1)
Github repository about-r, path: /functions/text.R

See also

R functions for graphics
Index to (some) R functions
The adj parameter.

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758200859, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/R/functions/text(74): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78