powered by
compute x and y coordinates for placement of text box based upon the values of the function to avoid running into the graph line
positionTextBox(text, x, y, xPos, adj, nApprox = 10, reallyText)
returns a list c(ymin,ymax,strheight(text),xPos1)
character string text to insert in plot
numeric vector of x values
numeric vector of y values
numeric x position for text box
numeric vector param passed to text()
integer number of intervals to interpolate between x data points
Boolean if TRUE then execute text() command
x<-1:10 y<-1:10 plot(x,y,type="l") positionTextBox(text="TEXT ME",x=x,y=y,xPos=1, adj=c(0,0),nApprox=10,reallyText=TRUE)
Run the code above in your browser using DataLab