log2
and symlog
¶%useLatestDescriptors
%use lets-plot
LetsPlot.getInfo()
Lets-Plot Kotlin API v.4.9.0. Frontend: Notebook with dynamically loaded JS. Lets-Plot JS v.4.5.1.
fun getData(n: Int): Map<String, List<Double>> {
val x = (-n..n).map(Int::toDouble)
val y = x.map {
when {
it == 0.0 -> it
it > 0 -> exp(it)
else -> -exp(-it)
}
}
return mapOf("x" to x, "y" to y)
}
val data = getData(10)
val p = letsPlot(data) { x = "x"; y = "y" } + geomPoint()
gggrid(
listOf(
p + ggtitle("Default"),
p + scaleYContinuous(trans="symlog") + ggtitle("trans='symlog'"),
p + scaleYContinuous(trans="log10") + ggtitle("trans='log10'"),
p + scaleYContinuous(trans="log2") + ggtitle("trans='log2'"),
),
ncol=2
)