kandy 0.7.0 Help

Comparing Line vs. Path Plots

fun generateArchimedeanDataMap(n: Int = 25, k: Double = 1.0, a: Double = 1.0): Map<String, List<Double>> { val phi = List(n) { i -> 2.0 * PI * k * i.toDouble() / (n - 1) } val r = phi.map { angle -> (a * angle) / (2.0 * PI) } val x = (r zip phi).map { p -> p.first * cos(p.second) } val y = (r zip phi).map { p -> p.first * sin(p.second) } return mapOf("x" to x, "y" to y) } val aDataMap = generateArchimedeanDataMap(n = 200, k = 2.0)
val linePlot = plot(aDataMap) { line { x("x") y("y") } layout.title = "`line` layer" } val pathPlot = plot(aDataMap) { path { x("x") y("y") } layout.title = "`path` layer" } plotGrid(listOf(linePlot, pathPlot))
Comparing Line vs. Path Plots
Last modified: 29 November 2023