This package provides methods for dynamically visualizing k-means clustering data or any ordinal data and its associated clusters, though the original intention was to provide users with a more user friendly visualization tool for k-means clustering.
Use requires package htmlwidgets
.
library(devtools)
install_github("ramnathv/htmlwidgets")
install_github("McKayMDavis/klustR")
pcplot
,
a dynamic visualization of dimensionally reduced data:<- scale(state.x77)
scaled_df <- kmeans(data_scaled, 5)$cluster
clus pcplot(data = data_scaled, clusters = clus)
Things to note:
Clicking on an axis label will display a bar-chart of each column’s contribution percentage to that particular dimension or principal component
Hovering over points displays the label
Clicking on a color on the legend highlights the associated cluster
pacoplot
,
a dynamic parallel coordinates plot:<- state.x77
df <- kmeans(data_scaled, 5)$cluster
clus pacoplot(data = df, clusters = clus)
Things to note:
Hovering over a line displays the label
Clicking on a line highlights the associated cluster
Clicking on the “Toggle Averages” box displays median lines and 1st and 3rd quartile intervals for each cluster
Visit website for more details.