Skip to contents

UMAP/t-SNE/PCA scatter plot of work embeddings, coloured by cluster.

Usage

sm_plot_landscape(
  corpus,
  color_by = "cluster_id",
  reducer = c("umap", "tsne", "pca"),
  n_components = 2L,
  dark = FALSE,
  ...
)

Arguments

corpus

An sm_corpus with embeddings.

color_by

Column name in works to colour by. Default "cluster_id".

reducer

Dimensionality reduction method.

n_components

Number of output dimensions (2 for plotting).

dark

Logical; dark mode?

...

Additional arguments.

Value

A ggplot object with one point per row of corpus$embeddings, so works without an embedding are not shown.

Details

UMAP retains its Euclidean metric and automatic thread settings. If its PCA dependency raises the known older-R NULL-input error, it retries with base SVD initialisation and reports scimapR_umap_pca_fallback. Other errors propagate unchanged.

Examples

corpus <- sm_example_corpus()
corpus <- sm_cluster_hdbscan(corpus, min_cluster_size = 10)
#> ✔ HDBSCAN clustering complete.
#> ℹ 5 clusters found, 0 noise points.
sm_plot_landscape(corpus)