Learn R Programming

largeVis (version 0.2.1.1)

gplot: gplot

Description

Plot an hdbscan object, using ggplot. The plot is primarily intended for diagnostic purposes, but can be useful to undertand how clusters were generated.

Usage

gplot(x, coords, text = FALSE, distances = FALSE)

Arguments

x

An hdbscan object.

coords

Coordinates for the points clustered in x.

text

If TRUE, include on the plot labels for each node's index. If "parent", the labels will instead be the index number of the node's cluster.

distances

If TRUE, draw circles representing the core distances around each point.

Value

A ggplot object

Details

Point color corresponds to clusters, with outliers as the NA color. Alpha corresponds to the node's GLOSH score. The segments on the plot correspond to the connections on the minimum spanning tree. Segment alpha corresponds to \(\lambda_p\).

If the parameter text is set to TRUE or "parent", the nodes will be labelled with the node index number or cluster index number, respectively.

Examples

Run this code
# NOT RUN {
library(largeVis)
# The aggregation dataset can be downloaded from https://github.com/elbamos/clusteringdatasets
data(Aggregation)
dat <- as.matrix(Aggregation[, 1:2])
aggregateVis <- largeVis(dat, K = 10, tree_threshold = 100,
                         max_iter = 5, sgd_batches = 1)
clusters <- hdbscan(aggregateVis, verbose = FALSE)
gplot(clusters, dat)
# }

Run the code above in your browser using DataLab