Several Ribbons
val times = listOf("00:00", "06:00", "12:00", "18:00", "24:00")
val btcMin = listOf(310, 225, 202, 278, 360)
val btcMax = listOf(334, 307, 243, 293, 388)
val ethMin = listOf(180, 205, 256, 300, 280)
val ethMax = listOf(210, 234, 299, 322, 331)
val dataset = dataFrameOf(
"time" to times + times,
"min" to btcMin + ethMin,
"max" to btcMax + ethMax,
"currency" to List(5) { "btc" } + List(5) { "eth" }
)
dataset.groupBy("currency").plot {
ribbon {
x("time")
y {
limits = 170..400
axis.name = "price, tokens"
}
yMin("min")
yMax("max")
fillColor("currency") {
legend.breaksLabeled("btc" to "Bubble Tea\nCoin", "eth" to "E-Traders\nHedgehogs")
}
alpha = 0.6
borderLine.width = 0.0
}
}
val times = listOf("00:00", "06:00", "12:00", "18:00", "24:00")
val btcMin = listOf(310, 225, 202, 278, 360)
val btcMax = listOf(334, 307, 243, 293, 388)
val ethMin = listOf(180, 205, 256, 300, 280)
val ethMax = listOf(210, 234, 299, 322, 331)
val dataset = mapOf(
"time" to times + times,
"min" to btcMin + ethMin,
"max" to btcMax + ethMax,
"currency" to List(5) { "btc" } + List(5) { "eth" }
)
dataset.plot {
groupBy("currency") {
ribbon {
x("time")
y {
limits = 170..400
axis.name = "price, tokens"
}
yMin("min")
yMax("max")
fillColor("currency") {
legend.breaksLabeled("btc" to "Bubble Tea\nCoin", "eth" to "E-Traders\nHedgehogs")
}
alpha = 0.6
borderLine.width = 0.0
}
}
}
Last modified: 10 May 2024