Transform a layout matrix into a position one
layout2position.Rd
This function transforms layout's informations into a position matrix useful for
ADEgS
and for lattice
graphics.
Arguments
- mat
a matrix indicating the location of figures to display (each value must be 0 or a positive integer) or a two-length vector indicating the number of rows and columns in the corresponding layout.
- widths
a vector of relative values for the columns' widths on the device. Their sum must be equal to the number of columns.
- heights
a vector of relative values for the rows' heights on the device. Their sum must be equal to the number of rows.
- ng
a value for the number of positions needed (i.e. the number of graphics to plot)
- square
a logical indicating if the graphics is an isometric plot
Value
A four-columns matrix indicating the coordinates (in normalized parent coordinates npc
)
of the top-right and bottom-left hand corners of each displayed figure on the device.
Author
Alice Julien-Laferriere, Aurelie Siberchicot aurelie.siberchicot@univ-lyon1.fr and Stephane Dray
Examples
layout2position(mat = rbind(c(0, 0, 1), c(2, 2, 1)))
#> [,1] [,2] [,3] [,4]
#> [1,] 0.6666667 0 1.0000000 1.0
#> [2,] 0.0000000 0 0.6666667 0.5
layout2position(mat = cbind(c(0, 0, 1), c(2, 2, 1)), widths = c(0.5, 1.5))
#> [,1] [,2] [,3] [,4]
#> [1,] 0.00 0.0000000 1 0.3333333
#> [2,] 0.25 0.3333333 1 1.0000000