Tiles Gradient
val cities = listOf("Yerevan", "Berlin", "Amsterdam", "Paphos")
val random = kotlin.random.Random(42)
val year22 = List(4) { random.nextDouble() }
val year23 = List(4) { random.nextDouble() }
val year24 = List(4) { random.nextDouble() }
val dataset = dataFrameOf(
"city" to cities,
"2022" to year22,
"2023" to year23,
"2024" to year24
).gather("2022", "2023", "2024").into("year", "value")
dataset.plot {
tiles {
x("city")
y("year") {
scale = categorical()
axis.breaks(format = "d")
}
fillColor("value")
}
}
val cities = listOf("Yerevan", "Berlin", "Amsterdam", "Paphos")
val random = kotlin.random.Random(42)
val year22 = List(4) { random.nextDouble() }
val year23 = List(4) { random.nextDouble() }
val year24 = List(4) { random.nextDouble() }
val dataset = mapOf(
"city" to cities + cities + cities,
"year" to List(4) { "2022" } + List(4) { "2023" } + List(4) { "2024" },
"value" to year22 + year23 + year24,
)
dataset.plot {
tiles {
x("city")
y("year") {
scale = categorical()
axis.breaks(format = "d")
}
fillColor("value")
}
}
Last modified: 06 December 2023