Skip to contents

plot() draws the hierarchy of the topics as a dendrogram with the topic labels as leaves and the cosine distance between topic centers on the vertical axis. Topics joined low in the tree are near-duplicates; topics joined only near the top are distinct from the rest.

Usage

# S3 method for class 'sbert_topic_hierarchy'
plot(x, main = "Topic hierarchy", cex = 0.8, ...)

Arguments

x

A hierarchy built by topic_hierarchy().

main

Plot title (default "Topic hierarchy").

cex

Size of the leaf labels (default 0.8).

...

Passed to the plot() method of stats::hclust().

Value

x, invisibly. Called for the plot.

Examples

corpus <- head(dedupe(feedback_translations, column = "translation"), 600)
topic_model <- topics(corpus, n_topics = 6, column = "translation",
                      embeddings = feedback_embeddings, label = "terms")
plot(topic_hierarchy(topic_model))