Function to visualise codebook matrix using barplot for all hexagons or a specific one

Description

visHexBarplot is supposed to visualise codebook matrix using barplot for all hexagons or a specific one

Usage

visHexBarplot(sObj, which.hexagon = NULL, which.hexagon.highlight = NULL, height = 7, 
  margin = rep(0.1, 4), colormap = c("customized", "bwr", "jet", "gbr", "wyr", 
          "br", "yr", "rainbow", "wb"), customized.color = "red", zeropattern.color = "gray", 
      gp = grid::gpar(cex = 0.7, font = 1, col = "black"), bar.text.cex = 0.8, bar.text.srt = 90, 
      newpage = TRUE)

Arguments

sObj
an object of class "sMap" or "sTopol" or "sInit"
which.hexagon
the integer specifying which hexagon to display. If NULL, all hexagons will be visualised
which.hexagon.highlight
an integer vector specifying which hexagons are labelled. If NULL, all hexagons will be labelled
height
a numeric value specifying the height of device
margin
margins as units of length 4 or 1
colormap
short name for the predifined colormap, and "customized" for custom input (see the next 'customized.color'). The predifined colormap can be one of "jet" (jet colormap), "bwr" (blue-white-red colormap), "gbr" (green-black-red colormap), "wyr" (white-yellow-red colormap), "br" (black-red colormap), "yr" (yellow-red colormap), "wb" (white-black colormap), and "rainbow" (rainbow colormap, that is, red-yellow-green-cyan-blue-magenta). Alternatively, any hyphen-separated HTML color names, e.g. "blue-black-yellow", "royalblue-white-sandybrown", "darkgreen-white-darkviolet". A list of standard color names can be found in http://html-color-codes.info/color-names
customized.color
the customized color for pattern visualisation
zeropattern.color
the color for zero horizental line
gp
an object of class "gpar". It is the output from a call to the function "gpar" (i.e., a list of graphical parameter settings)
bar.text.cex
a numerical value giving the amount by which bar text should be magnified relative to the default (i.e., 1)
bar.text.srt
a numerical value giving the angle by which bar text should be orientated
newpage
logical to indicate whether to open a new page. By default, it sets to true for opening a new page

Value

invisible

Note

none

Examples

# 1) generate data with an iid matrix of 1000 x 9 data <- cbind(matrix(rnorm(1000*3,mean=0,sd=1), nrow=1000, ncol=3), matrix(rnorm(1000*3,mean=0.5,sd=1), nrow=1000, ncol=3), matrix(rnorm(1000*3,mean=-0.5,sd=1), nrow=1000, ncol=3)) colnames(data) <- c("S1","S1","S1","S2","S2","S2","S3","S3","S3") # 2) sMap resulted from using by default setup sMap <- sPipeline(data=data)
Start at 2017-03-27 18:55:23 First, define topology of a map grid (2017-03-27 18:55:23)... Second, initialise the codebook matrix (169 X 9) using 'linear' initialisation, given a topology and input data (2017-03-27 18:55:23)... Third, get training at the rough stage (2017-03-27 18:55:23)... 1 out of 2 (2017-03-27 18:55:23) updated (2017-03-27 18:55:23) 2 out of 2 (2017-03-27 18:55:23) updated (2017-03-27 18:55:23) Fourth, get training at the finetune stage (2017-03-27 18:55:23)... 1 out of 7 (2017-03-27 18:55:23) updated (2017-03-27 18:55:23) 2 out of 7 (2017-03-27 18:55:23) updated (2017-03-27 18:55:23) 3 out of 7 (2017-03-27 18:55:23) updated (2017-03-27 18:55:23) 4 out of 7 (2017-03-27 18:55:23) updated (2017-03-27 18:55:23) 5 out of 7 (2017-03-27 18:55:23) updated (2017-03-27 18:55:23) 6 out of 7 (2017-03-27 18:55:23) updated (2017-03-27 18:55:23) 7 out of 7 (2017-03-27 18:55:23) updated (2017-03-27 18:55:23) Next, identify the best-matching hexagon/rectangle for the input data (2017-03-27 18:55:23)... Finally, append the response data (hits and mqe) into the sMap object (2017-03-27 18:55:23)... Below are the summaries of the training results: dimension of input data: 1000x9 xy-dimension of map grid: xdim=15, ydim=15, r=8 grid lattice: hexa grid shape: suprahex dimension of grid coord: 169x2 initialisation method: linear dimension of codebook matrix: 169x9 mean quantization error: 4.27816289846339 Below are the details of trainology: training algorithm: batch alpha type: invert training neighborhood kernel: gaussian trainlength (x input data length): 2 at rough stage; 7 at finetune stage radius (at rough stage): from 4 to 1 radius (at finetune stage): from 1 to 1 End at 2017-03-27 18:55:23 Runtime in total is: 0 secs
# 3) plot codebook patterns using different types # 3a) for all hexagons visHexBarplot(sMap) # 3b) only for the first hexagon visHexBarplot(sMap, which.hexagon=1)