Ribbon
fun generateDataMap(n: Int = 15, a: Double = 1.0): Map<String, List<Any>> {
val rand = java.util.Random(42)
val x = List(2 * n + 1) { i -> a * (i - n).toDouble() / n }
val tMin = x.map { a * a - it.pow(2) - abs(rand.nextGaussian()) }
val tMax = x.map { a * a - it.pow(2) + abs(rand.nextGaussian()) }
return mapOf("day" to (1..x.size).toList(), "minTemp" to tMin, "maxTemp" to tMax)
}
val dataMap = generateDataMap(a = 2.0)
plot(dataMap) {
ribbon {
x("day"<Int>()) { axis.name = "time" }
yMin("minTemp"<Double>())
yMax("maxTemp"<Double>())
}
}
Last modified: 28 November 2023