positionTextBoxDriverDriver {textBoxPlacement}R Documentation

positionTextBoxDriverDriver

Description

Driver to compute x and y coordinates for placement of text box based upon the y values of the function to avoid running into the graph line and avoid overlapping with other overlay curves

Usage

positionTextBoxDriverDriver(
  xList,
  yList,
  textList,
  xPos,
  nApprox = 10,
  labs,
  stag = FALSE,
  offset = 0,
  ystart,
  ylim,
  verbose
)

Arguments

xList

list whose components are numeric vectors of the x values for overlaid curves

yList

list whose components are numeric vectors of the y values for overlaid curves

textList

list of character string texts to insert in plot

xPos

numeric vector x position for text box

nApprox

integer number of intervals to interpolate between x data points

labs

list of labels annotating a graph

  • main character string main title

  • xlab character string x axis label

  • ylab character string y axis label

stag

Boolean TRUE if this plot has staggering added to curves

offset

numeric vector of offsets added to each curve

ystart

numeric vector of starting positions

ylim

numeric vector ylim parameter for plot()

verbose

Boolean if TRUE print informative or diagnostic messages to console

Details

if the length of the return value is not 0, then additional processing might be needed for the bad curves, such as adding an offset to their y values, plotting them in a different color or symbol, and keying them to a second y axis on the right of the graph

Value

returns a vector of integers indicating curves whose text box could not be drawn

Examples

# the text box for the second curve cannot fit,
# as it is sandwiched between two curves that are too close

plot(xList1[[1]],yList1[[1]],type="l")
positionTextBoxDriverDriver(xList=xList1,yList=yList1,
  textList=textList,xPos=c(1,1,1),nApprox=10,labs=labs,
  stag=FALSE,offset=0,ystart=0,ylim=axesRange(yList1),verbose=TRUE)


[Package textBoxPlacement version 1.0 Index]