Wrapper around Python BERTopic.visualize_hierarchical_documents().
This function visualizes documents and their topics in 2D at different
levels of a hierarchical topic structure.
bertopic_visualize_hierarchical_documents(
model,
docs,
hierarchical_topics,
topics = NULL,
embeddings = NULL,
reduced_embeddings = NULL,
sample = NULL,
hide_annotations = FALSE,
hide_document_hover = TRUE,
nr_levels = 10L,
level_scale = c("linear", "log"),
custom_labels = FALSE,
title = NULL,
width = NULL,
height = NULL,
file = NULL
)If file is NULL, an htmltools::HTML object. Otherwise, the
normalized file path is returned invisibly.
A "bertopic_r" model.
Character vector of documents used in fit / fit_transform.
A data frame or Python object as returned by
BERTopic.hierarchical_topics(docs, ...).
Optional integer vector of topic IDs to visualize.
Optional numeric matrix of document embeddings.
Optional numeric matrix of 2D reduced embeddings.
Optional numeric (0–1) or integer controlling subsampling of documents per topic (forwarded to Python).
Logical; if TRUE, hide cluster labels in the plot.
Logical; if TRUE, hide document text on hover to speed up rendering.
Integer; number of hierarchy levels to display.
Character, either "linear" or "log", controlling how hierarchy distances are scaled across levels.
Logical or character scalar controlling label behavior (forwarded to Python).
Optional character plot title.
Optional integer figure width/height in pixels.
Optional HTML output path. If NULL, an htmltools::HTML
object is returned.