ErrorBars with Line
val years = listOf("2018", "2019", "2020", "2021", "2022")
val costMin = listOf(62.7, 64.7, 72.1, 73.7, 68.5)
val costMax = listOf(68.9, 71.3, 78.9, 76.5, 72.1)
val mid = costMin.zip(costMax).map { (it.first + it.second) / 2.0 }
val dataset = dataFrameOf(
years.toColumn("years"),
costMin.toColumn("min"),
mid.toColumn("mid"),
costMax.toColumn("max")
)
dataset.plot {
x("years")
y("mid")
line {
color = Color.BLUE
}
errorBars {
yMin("min")
yMax("max")
borderLine.type = LineType.LONGDASH
}
}
val years = listOf("2018", "2019", "2020", "2021", "2022")
val costMin = listOf(62.7, 64.7, 72.1, 73.7, 68.5)
val costMax = listOf(68.9, 71.3, 78.9, 76.5, 72.1)
val mid = costMin.zip(costMax).map { (it.first + it.second) / 2.0 }
plot {
x(years)
y(mid)
line {
color = Color.BLUE
}
errorBars {
yMin(costMin)
yMax(costMax)
borderLine.type = LineType.LONGDASH
}
}
Last modified: 06 December 2023