Learn R Programming

textBoxPlacement (version 1.0)

positionTextBox: positionTextBox

Description

compute x and y coordinates for placement of text box based upon the values of the function to avoid running into the graph line

Usage

positionTextBox(text, x, y, xPos, adj, nApprox = 10, reallyText)

Value

returns a list c(ymin,ymax,strheight(text),xPos1)

Arguments

text

character string text to insert in plot

x

numeric vector of x values

y

numeric vector of y values

xPos

numeric x position for text box

adj

numeric vector param passed to text()

nApprox

integer number of intervals to interpolate between x data points

reallyText

Boolean if TRUE then execute text() command

Examples

Run this code
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