Compute a non-overlapping layout of text boxes to label multiple overlain curves. For each curve, iteratively search for an adjacent x,y position for the text box that does not overlap with the other curves. If this process fails, then offsets are computed to add to the y values for each curve, that results in sufficient space to add all of the text labels.
A typical example of the improved readability is shown in Figure 1, which is taken from
multiple real-world examples of graphs generated by this package and shown in more detail in the vignette for an upcoming R package entitled "Sherlock" (discovery and analysis of concordances for search patterns in a series of texts).
{width=90%}
Figure 1. Example of the improved readability after processing with textBoxPlacement()
The program is run as
result<-positionTextBoxDriverDriverDriver(xList,yList,textList,xPos,nApprox=10,labs,sortB)
where
xList (optional) list whose components are numeric matrices of the x values for overlain curves
yList list whose components are numeric matrices of the y values for overlain curves
textList (optional) list of character string texts to annotate the curves
xPos vector of trial x positions for text boxes
nApprox integer number of intervals to interpolate between adjacent 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
sortB Boolean if TRUE staggered curves reordered, with largest range curve on bottom of graph
knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.