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
# \donttest{
resUmatrix=GeneralizedUmatrix(Data,ProjectedPoints)
## visualization
plotTopographicMap(GeneralizedUmatrix = resUmatrix$Umatrix,resUmatrix$Bestmatches)
# }
## Open window in specific resolution
#relevant if Names given
# \donttest{
library(rgl)
r3dDefaults$windowRect = c(0,0,1200,1200)
plotTopographicMap(GeneralizedUmatrix = resUmatrix$Umatrix,resUmatrix$Bestmatches)
# }
if (FALSE) {
## 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')
}
## Save interactive html file
if (FALSE) {
widgets=plotTopographicMap(GeneralizedUmatrix = resUmatrix$Umatrix,resUmatrix$Bestmatches)
if(requireNamespace("htmlwidgets"))
htmlwidgets::saveWidget(widgets,file = "interactiveTopographicMap.html")
}
# \dontshow{
if(requireNamespace('deldir',quietly = TRUE))
resUmatrix=GeneralizedUmatrix(Data[1:2,],ProjectedPoints[1:2,])
#plotTopographicMap(resUmatrix$Umatrix,resUmatrix$Bestmatches)#testing takes longer than 5 secs
# }
Run the code above in your browser using DataLab