coordinates: coordinates of elements on a plot

Description Usage Arguments Details Value Author(s) Examples

View source: R/coordinates.R

Description

estimates coordinates of elements, neatly arranged on a plot.

Usage

1
2
coordinates(pos = NULL, mx = 0.0, my = 0.0, N = length(pos), 
            hor = TRUE, relsize = 1)

Arguments

pos

vector specifying the number of elements in each row, or 2-columned matrix with element position, or NULL.

mx

horizontal shift (x).

my

vertical shift (y).

N

total number of elements to be positioned - only if pos=NULL.

hor

only if pos is a 2-columned matrix. In this case, when hor = TRUE, pos specifies number of elements per row; when FALSE per column.

relsize

scaling factor as a function of graph size.

Details

the position of the elements are specified with pos, which is either NULL, or a vector specifying the number of elements on a row, or a 2-columned matrix specifying the (x,y) position of each element.

The offset from the x-axis and from the y-axis can be changed with mx and my.

Value

2-columned matrix, with coordinates (x,y) of each of the elements

Author(s)

Karline Soetaert <karline.soetaert@nioz.nl>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
openplotmat(main = "coordinates")

text(coordinates(N = 6), lab = LETTERS[1:6], cex = 2)

text(coordinates(N = 8, relsize = 0.5), lab = letters[1:8], cex = 2)

openplotmat(main = "coordinates")

text(coordinates(pos = c(2, 4, 2)), lab = letters[1:8], cex = 2)

plot(0, type = "n", xlim = c(0, 5), ylim = c(2, 8), main = "coordinates")

text(coordinates(pos = c(2, 4, 3), hor = FALSE), lab = 1:9, cex = 2)

Example output

Loading required package: shape

diagram documentation built on Oct. 23, 2020, 5:46 p.m.