Function to visualise various mapping items within a supra-hexagonal grid

Description

visHexMapping is supposed to visualise various mapping items within a supra-hexagonal grid

Usage

visHexMapping(sObj, mappingType = c("indexes", "hits", "dist", "antidist", "bases", 
  "customized"), labels = NULL, height = 7, margin = rep(0.1, 4), area.size = 1, 
      gp = grid::gpar(cex = 0.7, font = 1, col = "black"), border.color = NULL, fill.color = "transparent", 
      lty = 1, lwd = 1, lineend = "round", linejoin = "round", clip = c("on", "inherit", 
          "off"), newpage = TRUE)

Arguments

sObj
an object of class "sMap" or "sInit" or "sTopol"
mappingType
the mapping type, can be "indexes", "hits", "dist", "antidist", "bases", and "customized"
labels
NULL or a vector with the length of nHex
height
a numeric value specifying the height of device
margin
margins as units of length 4 or 1
area.size
an inteter or a vector specifying the area size of each hexagon
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)
border.color
the border color for each hexagon
fill.color
the filled color for each hexagon
lty
the line type for each hexagon. 0 for 'blank', 1 for 'solid', 2 for 'dashed', 3 for 'dotted', 4 for 'dotdash', 5 for 'longdash', 6 for 'twodash'
lwd
the line width for each hexagon
lineend
the line end style for each hexagon. It can be one of 'round', 'butt' and 'square'
linejoin
the line join style for each hexagon. It can be one of 'round', 'mitre' and 'bevel'
clip
either "on" for clipping to the extent of this viewport, "inherit" for inheriting the clipping region from the parent viewport, or "off" to turn clipping off altogether
newpage
logical to indicate whether to open a new page. By default, it sets to true for opening a new page

Value

invisible

Note

The mappingType includes:

  • "indexes": the index of hexagons in a supra-hexagonal grid
  • "hits": the number of input data vectors hitting the hexagons
  • "dist": distance (in high-dimensional input space) to neighbors (defined in 2D output space)
  • "antidist": the oppose version of "dist"
  • "bases": clusters partitioned from the sMap
  • "customized": displaying input "labels"

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 2018-01-18 16:56:29 First, define topology of a map grid (2018-01-18 16:56:29)... Second, initialise the codebook matrix (169 X 9) using 'linear' initialisation, given a topology and input data (2018-01-18 16:56:29)... Third, get training at the rough stage (2018-01-18 16:56:29)... 1 out of 2 (2018-01-18 16:56:29) updated (2018-01-18 16:56:29) 2 out of 2 (2018-01-18 16:56:29) updated (2018-01-18 16:56:29) Fourth, get training at the finetune stage (2018-01-18 16:56:29)... 1 out of 7 (2018-01-18 16:56:29) updated (2018-01-18 16:56:29) 2 out of 7 (2018-01-18 16:56:29) updated (2018-01-18 16:56:29) 3 out of 7 (2018-01-18 16:56:29) updated (2018-01-18 16:56:29) 4 out of 7 (2018-01-18 16:56:29) updated (2018-01-18 16:56:29) 5 out of 7 (2018-01-18 16:56:29) updated (2018-01-18 16:56:29) 6 out of 7 (2018-01-18 16:56:29) updated (2018-01-18 16:56:29) 7 out of 7 (2018-01-18 16:56:29) updated (2018-01-18 16:56:29) Next, identify the best-matching hexagon/rectangle for the input data (2018-01-18 16:56:29)... Finally, append the response data (hits and mqe) into the sMap object (2018-01-18 16:56:29)... 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.27891105682274 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 2018-01-18 16:56:29 Runtime in total is: 0 secs
# 3) visualise supported mapping items within a supra-hexagonal grid # 3a) for indexes of hexagons visHexMapping(sMap, mappingType="indexes", fill.color="transparent") # 3b) for the number of input data vectors hitting the hexagons visHexMapping(sMap, mappingType="hits", fill.color=NULL) # 3c) for distance (in high-dimensional input space) to neighbors (defined in 2D output space) visHexMapping(sMap, mappingType="dist") # 3d) for clusters/bases partitioned from the sMap visHexMapping(sMap, mappingType="bases")