martmists
07/12/2024, 1:50 PMUnequal column sizes. Expected rows count: 35. Actual column sizes:
x: 35
y: 35
x*: 31val clusters = clusterKMeans(3, vectors)
        plot {
            points {
                for ((cluster, clusterColor) in clusters.zip(colors)) {
                    x(cluster.map { it[0] })
                    y(cluster.map { it[1] })
                    color = clusterColor
                }
            }
        }.save("kmeans-3.png")Andrei Kislitsyn
07/12/2024, 2:32 PMAndrei Kislitsyn
07/12/2024, 2:33 PMplot {
    points {
        x(clusters.flatMap { cluster -> cluster.map { it[0] } })
        y(clusters.flatMap { cluster -> cluster.map { it[1] } })
        color(clusters.flatMapIndexed { index, cluster -> List(cluster.size) { index } }) {
            scale = categorical(colors, colors.indices.toList())
        }
    }
}martmists
07/12/2024, 3:55 PM"color" to colors.keys.map {
                val r = (it[0] * 255).roundToInt()
                val g = (it[1] * 255).roundToInt()
                val b = (it[2] * 255).roundToInt()
                Color.rgb(r, g, b)
            }fillColor("color")Andrei Kislitsyn
07/12/2024, 4:03 PMidentitycolorAndrei Kislitsyn
07/12/2024, 4:09 PMcolor"color" to listOf("a", "b", "c", "a", etc)fillColor("color") {
   scale = categorical("a" to Color.RED, "b" to Color.BLUE, "c" to... )
   scale = categorical("a" to Color.RED, "b" to Color.BLUE, "c" to... )Andrei Kislitsyn
07/12/2024, 4:16 PM