Automatic text placement

Share:

Description

Automatically places a given character string in the sparsest location of the space spanned by the the x and y input coordinates.

Usage

1
autoText(x, y=NULL, text.="", cex=1, col=1, nquadrant=5)

Arguments

x

if y is not NULL, this argument is a numeric vector containing the abscissa (x-axis) values for the current plot. If y=NULL, this argument is taken as a numeric vector of ordinate (y-axis) values.

cex

par function character expansion value. Default: 1.

col

par function color value for the text. Default: 1.

nquadrant

an integer denoting the number of quadrants to partition the space spanned by x and y. For example, if nquadrants=3, the x-y space is partitioned into a 3x3 grid of equisized blocks. Default: 5.

text.

a character string to place in the current plot. Default: ""

y

a numeric vector containing the ordinate (y-axis) values in the current plot. If NULL, the x input argument is taken as the y-axis values while the x-axis values are extracted from x via the positions function. If there are no positions available, then the sequence 1:length(x) is used as the x-axis positions. Default: NULL.

Value

no output is returned.

Note

The defined text is positioned in the estimated sparsest region of the specified data set.

See Also

text, autoKey, sparsestQuadrant, mergeList.

Examples

1
2
3
4
5
## quadratic 
x <- seq(-5,5)
y <- x^2
plot(x,y,type="p")
autoText(x, y, text="Some text in a parabola", cex=1.5)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.