plotTopographicMap: Visualizes the Generalized U-matrix in 3D

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/plotTopographicMap.R

Description

The generalized U-matrix is visualized as the topographic map with hypsometric tints. The topographic map represents high-dimensional distance and density-based structurs in form of a 3D landscape.

Usage

1
2
3
4
5
plotTopographicMap(GeneralizedUmatrix, BestMatchingUnits,

Cls=NULL,ClsColors=NULL,Imx=NULL,Names=NULL,

BmSize=0.5,RenderingContourLines=TRUE,...)

Arguments

GeneralizedUmatrix

(1:Lines,1:Columns), [1:Lines,1:Columns] Umatrix to be plotted, numerical matrix storing the U-heights, see [Thrun, 2018] for definition.

BestMatchingUnits

(1:n,1:2), Positions of bestmatches to be plotted as spheres onto the topographic map

Cls

(1:n), numerical vector of classification of k clusters, one label for each bestmatch at that given point

ClsColors

Vector of colors that will be used to colorize the different clusters, default is GeneralizedUmatrix::DefaultColorSequence

Imx

a mask (Imx) that will be used to cut out the umatrix

Names

If set: [1:k] character vector naming the k clusters for the legend. . In this case, further parameters with the possibility to adjust are: NamesCex: (size); NamesPosition: Legend position; NamesTitle: title of legend; NamesColors: colors if ClsColors are not default (NULL), etc.

BmSize

size(diameter) of the points in the visualizations. The points represent the BestMatchingUnits

RenderingContourLines

FALSE: disables plotting of contour lines resulting in a much faster plot.

...

Besides the legend/names parameter the list of further parameters, use only of you know what you are doing:

Tiled

Should the Umatrix be drawn 4times?

ShowAxis

shall the axis be shown?

NoLevels

number of contour lines

ExtendBorders

scalar, extends Umatrix by toroidal continuation of the given Umatrix

Colormap

in the case of density p matrix...

title

same as main

main

same as title

sub

same as in plot

xlab

same as in plot

ylab

same as in plot

zlab

same as in plot

NamesPosition

same as in bgplot3d

NamesColors

same as col in bgplot3d

NamesCex

same as cex in bgplot3d

NamesTitle

same as title in bgplot3d

NamesPch

same as pch in bgplot3d

Details

The visualization of this function is a topographic map with hypsometric tints (Thrun, Lerch, L?tsch, & Ultsch, 2016). "Hypsometric tints are surface colors that represent ranges of elevation (Patterson and Kelso 2004). Here, contour lines are combined with a specific color scale. The color scale is chosen to display various valleys, ridges, and basins: blue colors indicate small distances (sea level), green and brown colors indicate middle distances (low hills), and white colors indicate vast distances (high mountains covered with snow and ice). Valleys and basins represent clusters, and the watersheds of hills and mountains represent the borders between clusters. In this 3D landscape, the borders of the visualization are cyclically connected with a periodicity (L,C). The number of clusters can be estimated by the number of valleys of the visualization. The clustering is valid if mountains do not partition clusters indicated by colored points of the same color and colored regions of points (see examples in section 4.1 and 4.2)."[Thrun/Ultsch, 2020].

A central problem in clustering is the correct estimation of the number of clusters. This is addressed by the topographic map which allows assessing the number of clusters as the number of valleys (Thrun et al., 2016). Please see chapter 5 of [Thrun, 2018] for further details.

Value

An object of class "htmlwidget" in mode invisible, please rglwidget for details.

Note

First version of algorithm was partly based on the Umatrix package.

Author(s)

Michael Thrun

References

[Thrun, 2018] Thrun, M. C.: Projection Based Clustering through Self-Organization and Swarm Intelligence, doctoral dissertation 2017, Springer, Heidelberg, ISBN: 978-3-658-20539-3, doi: 10.1007/978-3-658-20540-9, 2018.

[Thrun et al., 2016] Thrun, M. C., Lerch, F., Loetsch, J., & Ultsch, A.: Visualization and 3D Printing of Multivariate Data of Biomarkers, in Skala, V. (Ed.), International Conference in Central Europe on Computer Graphics, Visualization and Computer Vision (WSCG), Vol. 24, Plzen, http://wscg.zcu.cz/wscg2016/short/A43-full.pdf, 2016.

[Thrun/Ultsch, 2020] Thrun, M. C., & Ultsch, A. : Using Projection based Clustering to Find Distance and Density based Clusters in High-Dimensional Data, Journal of Classification, DOI 10.1007/s00357-020-09373-2, in press, Springer, 2020.

See Also

GeneralizedUmatrix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
data("Chainlink")
Data=Chainlink$Data
Cls=Chainlink$Cls
InputDistances=as.matrix(dist(Data))
res=cmdscale(d=InputDistances, k = 2, eig = TRUE, add = FALSE, x.ret = FALSE)
ProjectedPoints=as.matrix(res$points)
#see also ProjectionBasedClustering package for other common projection methods

resUmatrix=GeneralizedUmatrix(Data,ProjectedPoints)
## visualization
plotTopographicMap(GeneralizedUmatrix = resUmatrix$Umatrix,resUmatrix$Bestmatches)


## Open window in specific resolution
#relevant if Names given

library(rgl)
r3dDefaults$windowRect = c(0,0,1200,1200) 
plotTopographicMap(GeneralizedUmatrix = resUmatrix$Umatrix,resUmatrix$Bestmatches)

## Not run: 
## To save as STL for 3D printing
 rgl::writeSTL("GenerelizedUmatrix_3d_model.stl")

## Save the visualization as a picture with
library(rgl)
rgl.snapshot('test.png')

## End(Not run)

## Save interactive html file
## Not run: 
widgets=plotTopographicMap(GeneralizedUmatrix = resUmatrix$Umatrix,resUmatrix$Bestmatches)
if(requireNamespace("htmlwidgets"))
  htmlwidgets::saveWidget(widgets,file = "interactiveTopographicMap.html")

## End(Not run)

GeneralizedUmatrix documentation built on Jan. 16, 2021, 5:37 p.m.