Ribbon With Line
val day by columnOf("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")
val low by columnOf(16345f, 18718f, 17541f, 17302f, 15991f, 18315f, 20189f)
val high by columnOf(18252f, 19912f, 19001f, 21540f, 18770f, 20945f, 23007f)
val mid by (low.values().zip(high.values()).map { (it.second + it.first) / 2 }).toColumn()
val df = dataFrameOf(day, low, mid, high)
df.plot {
x(day) { axis.name = "day of week" }
y {
axis.name = "price"
scale = continuous(15000f..24000f)
}
line {
y(mid)
color = Color.GREEN
type = LineType.DOTTED
width = 2.0
}
ribbon {
yMin(low)
yMax(high)
borderLine.color = Color.BLUE
}
}
val day = listOf("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")
val low = listOf(16345f, 18718f, 17541f, 17302f, 15991f, 18315f, 20189f)
val high = listOf(18252f, 19912f, 19001f, 21540f, 18770f, 20945f, 23007f)
val mid = low.zip(high).map { (it.second + it.first) / 2 }
plot {
x(day) { axis.name = "day of week" }
y {
axis.name = "price"
scale = continuous(15000f..24000f)
}
line {
y(mid)
color = Color.GREEN
type = LineType.DOTTED
width = 2.0
}
ribbon {
yMin(low)
yMax(high)
borderLine.color = Color.BLUE
}
}
Last modified: 10 May 2024