kandy 0.7.0 Help

Marked Line

val months = listOf( "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ) val tempBerlin = listOf(-0.5, 0.0, 4.8, 9.0, 14.3, 17.5, 19.2, 18.9, 14.5, 9.7, 4.7, 1.0) val tempMadrid = listOf(6.3, 7.9, 11.2, 12.9, 16.7, 21.1, 24.7, 24.2, 20.3, 15.4, 9.9, 6.6) val df = dataFrameOf( "month" to months + months, "temperature" to tempBerlin + tempMadrid, "city" to List(12) { "Berlin" } + List(12) { "Madrid" } ) df.plot { line { x("month") y("temperature") color("city") { scale = categorical("Berlin" to Color.PURPLE, "Madrid" to Color.ORANGE) } width = 1.5 } hLine { yIntercept.constant(tempBerlin.average()) color = Color.PURPLE alpha = 0.9 type = LineType.DASHED } hLine { yIntercept.constant(tempMadrid.average()) color = Color.ORANGE alpha = 0.9 type = LineType.DASHED } layout.size = 1000 to 450 }
val months = listOf( "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ) val tempBerlin = listOf(-0.5, 0.0, 4.8, 9.0, 14.3, 17.5, 19.2, 18.9, 14.5, 9.7, 4.7, 1.0) val tempMadrid = listOf(6.3, 7.9, 11.2, 12.9, 16.7, 21.1, 24.7, 24.2, 20.3, 15.4, 9.9, 6.6) val df = mapOf( "month" to months + months, "temperature" to tempBerlin + tempMadrid, "city" to List(12) { "Berlin" } + List(12) { "Madrid" } ) df.plot { line { x("month") y("temperature") color("city") { scale = categorical("Berlin" to Color.PURPLE, "Madrid" to Color.ORANGE) } width = 1.5 } hLine { yIntercept.constant(tempBerlin.average()) color = Color.PURPLE alpha = 0.9 type = LineType.DASHED } hLine { yIntercept.constant(tempMadrid.average()) color = Color.ORANGE alpha = 0.9 type = LineType.DASHED } layout.size = 1000 to 450 }
Marked Line
Last modified: 22 November 2023