| visHclust | R Documentation |
Visualize Hierarchical cluster analysis hclust. This function compute distance using dist, and
Hierarchical cluster analysis using hclust (from stats package or flashClust if installed), and
render the tree with visNetwork, adding informations. Can also be called on a hclust or dist object.
Needed packages : sparkline (graphics on tooltip), ggraph, igraph, flashClust
visHclust(object, ...)
## Default S3 method:
visHclust(object, ...)
## S3 method for class 'data.frame'
visHclust(
object,
main = "",
submain = "",
footer = "",
distColumns = NULL,
distMethod = "euclidean",
hclustMethod = "complete",
cutree = 0,
tooltipColumns = 1:ncol(object),
colorEdges = "black",
colorGroups = substr(rainbow(cutree), 1, 7),
highlightNearest = TRUE,
horizontal = FALSE,
minNodeSize = 50,
maxNodeSize = 200,
nodesPopSize = TRUE,
height = "600px",
width = "100%",
export = TRUE,
...
)
## S3 method for class 'dist'
visHclust(
object,
data = NULL,
main = "",
submain = "",
footer = "",
cutree = 0,
hclustMethod = "complete",
tooltipColumns = if (!is.null(data)) { 1:ncol(data) } else { NULL },
colorEdges = "black",
colorGroups = substr(rainbow(cutree), 1, 7),
highlightNearest = TRUE,
horizontal = FALSE,
minNodeSize = 50,
maxNodeSize = 200,
nodesPopSize = TRUE,
height = "600px",
width = "100%",
export = TRUE,
...
)
## S3 method for class 'hclust'
visHclust(
object,
data = NULL,
main = "",
submain = "",
footer = "",
cutree = 0,
tooltipColumns = if (!is.null(data)) { 1:ncol(data) } else { NULL },
colorEdges = "black",
colorGroups = substr(rainbow(cutree), 1, 7),
highlightNearest = TRUE,
horizontal = FALSE,
minNodeSize = 50,
maxNodeSize = 200,
nodesPopSize = TRUE,
height = "600px",
width = "100%",
export = TRUE,
...
)
object |
|
... |
Don't use |
main |
Title. See visNetwork |
submain |
Subtitle. See visNetwork |
footer |
Footer. See visNetwork |
distColumns |
|
distMethod |
|
hclustMethod |
|
cutree |
|
tooltipColumns |
|
colorEdges |
|
colorGroups |
|
highlightNearest |
|
horizontal |
|
minNodeSize |
|
maxNodeSize |
|
nodesPopSize |
|
height |
|
width |
|
export |
|
data |
|
## Not run:
#--------------
# data.frame
#--------------
# default call on data.frame
visHclust(iris, cutree = 3, colorEdges = "red")
# update some parameters
visHclust(iris, cutree = 3, tooltipColumns = c(1, 5),
colorGroups = c("red", "blue", "green"), horizontal = TRUE)
# no graphics on tooltip
visHclust(iris, cutree = 3, tooltipColumns = NULL,
main = "Hclust on iris")
# Title(s)
visHclust(iris, cutree = 3, main ="My_title",
submain = "My_sub_title", footer = "My_footer")
# Export
visHclust(iris, cutree = 3, export = TRUE)
# update group / individual nodes
visHclust(iris, cutree = 8) %>%
visGroups(groupname = "group", color ="black",
shape = "triangleDown", size = 75) %>%
visGroups(groupname = "individual",
font = list(size = 150),
color = list(background = "white", border = "purple",
highlight = "#e2e9e9", hover = "orange"), shape = "box")
#--------------
# dist
#--------------
# without adding data & info in tooltip
visHclust(dist(iris[,1:4]), cutree = 3)
# adding data & info in tooltip
visHclust(dist(iris[,1:4]), cutree = 3, data = iris)
#--------------
# hclust
#--------------
# without adding data & info in tooltip
visHclust(hclust(dist(iris[,1:4])), cutree = 3)
# adding data & info in tooltip
visHclust(hclust(dist(iris[,1:4])), cutree = 3, data = iris)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.