visHexMulComp: Function to visualise multiple component planes of a...

Description Usage Arguments Value Note See Also Examples

View source: R/visHexMulComp.r

Description

visHexMulComp is supposed to visualise multiple component planes of a supra-hexagonal grid

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
visHexMulComp(
sMap,
which.components = NULL,
rect.grid = NULL,
margin = rep(0.1, 4),
height = 7,
title.rotate = 0,
title.xy = c(0.45, 1),
colormap = c("bwr", "jet", "gbr", "wyr", "br", "yr", "rainbow", "wb"),
ncolors = 40,
zlim = NULL,
border.color = "transparent",
gp = grid::gpar(),
newpage = TRUE
)

Arguments

sMap

an object of class "sMap"

which.components

an integer vector specifying which compopnets will be visualised. By default, it is NULL meaning all components will be visualised

rect.grid

a vector specifying the number of rows and columns for a rectangle grid wherein the component planes are placed. By defaul, it is NULL (decided on according to the number of component planes that will be visualised)

margin

margins as units of length 4 or 1

height

a numeric value specifying the height of device

title.rotate

the rotation of the title

title.xy

the coordinates of the title

colormap

short name for the colormap. It 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

ncolors

the number of colors specified

zlim

the minimum and maximum z values for which colors should be plotted, defaulting to the range of the finite values of z. Each of the given colors will be used to color an equispaced interval of this range. The midpoints of the intervals cover the range, so that values just outside the range will be plotted

border.color

the border color for each hexagon

gp

an object of class gpar, typically the output from a call to the function gpar (i.e., a list of graphical parameter settings)

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

See Also

visVp, visHexComp, visColorbar

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# 1) generate data with an iid matrix of 1000 x 3
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)

# 3) visualise multiple component planes of a supra-hexagonal grid
visHexMulComp(sMap, colormap="jet", ncolors=20, zlim=c(-1,1),
gp=grid::gpar(cex=0.8))
# 3a) visualise only the first 6 component planes
visHexMulComp(sMap, which.components=1:6, colormap="jet", ncolors=20,
zlim=c(-1,1), gp=grid::gpar(cex=0.8))
# 3b) visualise only the first 6 component planes within the rectangle grid of 3 X 2
visHexMulComp(sMap, which.components=1:6, rect.grid=c(3,2),
colormap="jet", ncolors=20, zlim=c(-1,1), gp=grid::gpar(cex=0.8))

Example output

Loading required package: hexbin
Start at 2018-12-23 00:27:49

First, define topology of a map grid (2018-12-23 00:27:49)...
Second, initialise the codebook matrix (169 X 9) using 'linear' initialisation, given a topology and input data (2018-12-23 00:27:49)...
Third, get training at the rough stage (2018-12-23 00:27:49)...
	1 out of 2 (2018-12-23 00:27:49)
	updated (2018-12-23 00:27:49)
	2 out of 2 (2018-12-23 00:27:49)
	updated (2018-12-23 00:27:49)
Fourth, get training at the finetune stage (2018-12-23 00:27:49)...
	1 out of 7 (2018-12-23 00:27:49)
	updated (2018-12-23 00:27:49)
	2 out of 7 (2018-12-23 00:27:49)
	updated (2018-12-23 00:27:49)
	3 out of 7 (2018-12-23 00:27:49)
	updated (2018-12-23 00:27:49)
	4 out of 7 (2018-12-23 00:27:49)
	updated (2018-12-23 00:27:49)
	5 out of 7 (2018-12-23 00:27:49)
	updated (2018-12-23 00:27:50)
	6 out of 7 (2018-12-23 00:27:50)
	updated (2018-12-23 00:27:50)
	7 out of 7 (2018-12-23 00:27:50)
	updated (2018-12-23 00:27:50)
Next, identify the best-matching hexagon/rectangle for the input data (2018-12-23 00:27:50)...
Finally, append the response data (hits and mqe) into the sMap object (2018-12-23 00:27:50)...

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.27409167181232

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-12-23 00:27:50
Runtime in total is: 1 secs

dev.new(): using pdf(file="Rplots1.pdf")
dev.new(): using pdf(file="Rplots2.pdf")

supraHex documentation built on Nov. 26, 2020, 2:01 a.m.