# NOT RUN {
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
# }
# NOT RUN {
resUmatrix=GeneralizedUmatrix(Data,ProjectedPoints)
## visualization
plotTopographicMap(GeneralizedUmatrix = resUmatrix$Umatrix,resUmatrix$Bestmatches)
# }
# NOT RUN {
## Open window in specific resolution
#relevant if Names given
# }
# NOT RUN {
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')
# }
# NOT RUN {
## Save interactive html file
# }
# NOT RUN {
widgets=plotTopographicMap(GeneralizedUmatrix = resUmatrix$Umatrix,resUmatrix$Bestmatches)
if(requireNamespace("htmlwidgets"))
htmlwidgets::saveWidget(widgets,file = "interactiveTopographicMap.html")
# }
Run the code above in your browser using DataLab