I am using ggvis to plot clusters point in two dimensions. I have already clustered these points in greater number of dimensions. so every point in addition to its x,y cordinates has a Cluster number (range 0:-20). I want to generate a scatter plot where every point is positioned as per its co-ordinates and its colour should be as per its cluster. I am able to generate a scatter plot using the data. But for fill i am not getting distinct colours for cluster numbers greater then 10. Below is my code:
nm_clust%>% ggvis(~x, ~y, key := ~id,fill = ~factor(cluster)) %>%
layer_points()%>% set_options(width = 1000, height = 1000,resizable=T)%>%
add_legend("fill", title = "Clusters")%>%
add_tooltip(add_values,"hover")
The factors of cluster column of the dataset is as below:
levels(factor(nm_clust$cluster))
[1] "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14"
[16] "15" "16" "17" "18" "19" "20"
Can somebody tell where am i going wrong?