Function compose_design
extracts and validates required arguments from a list of parameters (three-dots construct) and passes them to internal function .compose_design
.
Argument legend
is a list
or coerced to a list
. The length of this list is equal to number of color bars; each item describes certain color bar. This desctiption is a list again with two elements, which desribes the position of color bar in relation to main panels of images.
If argument legend
is in interval 1L:4L
then it is interpreted as argument side
in functions axis
, mtext
. Argument side
in function compose_design
plays the same role. It is introduced for consistency with R graphic system.
In the one of example below (See Examples section) the layout with dimension of two rows by three columns is considered (layout=c(2,3)
). The dimension of resulting layout matrix is c(7,9)
, where 7=2*2+3, and 9=3*2+3.
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
[1,] 0 0 0 0 0 0 0 0 0
[2,] 0 0 0 0 0 0 0 0 0
[3,] 0 0 1 0 2 0 3 0 0
[4,] 0 0 0 0 0 0 0 0 0
[5,] 0 0 4 0 5 0 6 0 0
[6,] 0 0 0 0 0 0 0 0 0
[7,] 0 0 0 0 0 0 0 0 0
The complicated color bar structure is specified via R's list
function:
> leg <- list("7"=list(row=1,col=0),"8"=list(2,"left")
+ ,"9"=list("full","right"),"10"=list("top","full")
+ ,"11"=list(99,1:2),"12"=list("bottom",3))
> str(leg)
$ 7 :List of 2
..$ row: num 1
..$ col: num 0
$ 8 :List of 2
..$ : num 2
..$ : chr "left"
$ 9 :List of 2
..$ : chr "full"
..$ : chr "right"
$ 10:List of 2
..$ : chr "top"
..$ : chr "full"
$ 11:List of 2
..$ : num 99
..$ : int [1:2] 1 2
$ 12:List of 2
..$ : chr "bottom"
..$ : num 3
Here, six color bars are specified. It is a list of six lists (sub-lists). First item of sub-list is row number, and the second one is column number. Integers can be replaces by character keywords.
For row-position, "top"
means 0L
(less than first row), "bottom"
means large integer value (greater than last row, currently, 99L
), "first"
means 1L
, "last"
means number of last row (2L
in this example), "full"
means whole range from first to last rows (1L:2L
in this example). Values "top"
and "bottom"
are used for horizontal color bars (last three sub-lists), and the rest for vertical color bars (first three sub-lists).
For column-position, "left"
means 0L
(less then first column), "bottom"
means large integer value (greater than last column, currently, 99L
), "first"
means first column (1L
), "last"
means last column (3L
in this example), "full"
means whole range from first to last columns ((1L:3L
in this example)). Values "left"
and "right"
are used for vertical color bars, and the rest are for horizontal ones.
The resulting layout is a sparse matrix with zero values for each even row and each column. These zeros plays role of white space between panels in the plotted layout. In our example, values 1L:6L
are corresponded to six map panels, and values 7L:12L
are corresponded to six narrow panels of color bars (legends).
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
[1,] 0 0 10 0 10 0 10 0 0
[2,] 0 0 0 0 0 0 0 0 0
[3,] 7 0 1 0 2 0 3 0 9
[4,] 0 0 0 0 0 0 0 0 0
[5,] 8 0 4 0 5 0 6 0 9
[6,] 0 0 0 0 0 0 0 0 0
[7,] 0 0 11 0 11 0 12 0 0