compose_design | R Documentation |
compose_design
prepares scheme for layout of images and color bars.
compose_design(...)
... |
Set of arguments, which are recognized via their names and classes:
|
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
It is a list of class ursaLayout
.
layout |
Integer matrix with dimension |
image |
Nonnegative integer. Number of panels with images. |
dim |
Nonnegative integer of length two. Number of rows and number of columns for panel layout. |
legend |
Nonnegative integer. Number of panels with color bars (legends). |
The returned value is passed to function compose_open
and further is kept in the options
until calling of compose_close
.
Nikita Platonov platonov@sevin.ru
session_grid(NULL)
a <- ursa_dummy(nband=5,min=1,max=200,mul=1/8)
b <- list(colorize(a[1:3],pal.rich=240,pal.rotate=0)
,colorize(sqrt(a[4:5]),pal.rich=-15,pal.rotate=0,stretch="equal"))
cl1 <- compose_design(layout=c(2,3),byrow=TRUE,legend=NULL)
print(cl1)
compose_open(cl1)
compose_close()
cl2 <- compose_design(layout=c(2,3),byrow=FALSE,legend="left")
print(cl2$layout)
compose_open(cl2)
compose_close()
cl3 <- compose_design(a,side=2)
print(cl3)
compose_open(cl3)
compose_close()
cl4 <- compose_design(b)
print(cl4)
## to avoid over-time during example check -- begin
compose_open(cl4)
compose_plot(b,decor=FALSE,las=2)
compose_close("nocrop")
## to avoid over-time during example check -- end
cl5 <- compose_design(b,byrow=FALSE,skip=3
,legend=list(list("full","left"),list(1:2,"right")))
compose_open(cl5)
compose_plot(b,decor=FALSE)
compose_close("nocrop")
leg <- list(list(1,0),list(2,"left")
,list("full","right"),list("top","full")
,list(99,1:2),list("bottom",3))
str(leg)
cl6 <- compose_design(layout=c(2,3),skip=NA,legend=leg)
print(cl6)
compose_open(cl6,scale=3,pointsize=16)
compose_close("nocrop")
cl7 <- compose_design(layout=matrix(c(1,1,3,2,2,0),nrow=2,byrow=TRUE))
print(cl7)
compose_open(cl7)
compose_close()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.