plot_clusters: Plot Clusters in 2D Space

View source: R/visualization.R

plot_clustersR Documentation

Plot Clusters in 2D Space

Description

Visualize clustering results using first two dimensions or specified dimensions

Usage

plot_clusters(
  data,
  cluster_col = "cluster",
  x_col = NULL,
  y_col = NULL,
  centers = NULL,
  title = "Cluster Plot",
  color_noise_black = TRUE
)

Arguments

data

A data frame with cluster assignments

cluster_col

Name of cluster column (default: "cluster")

x_col

X-axis variable (if NULL, uses first numeric column)

y_col

Y-axis variable (if NULL, uses second numeric column)

centers

Optional data frame of cluster centers

title

Plot title

color_noise_black

If TRUE, color noise points (cluster 0) black

Value

A ggplot object


tidylearn documentation built on Feb. 6, 2026, 5:07 p.m.