lets-plot-kotlin
lets-plot-kotlin copied to clipboard
`scaleFillManual` doesn't work correctly with numbers
If domain of scale is numerical, scaleFillManual works like a continuous scale, even though it should work as discrete:
val yy = listOf(1, 2, 1, 2)
val cc = listOf(1, 2, 3, 4)
letsPlot() + geomTile() {
x = xx
y = yy
fill = cc
} + scaleFillManual(values = listOf("red", "green", "blue", "yellow"), limits = listOf(1, 2, 3, 4))
If limits are not specified, it works correctly:
This is expected behavior: scales created for a continuous (numeric) domain are continuous. Try asDiscrete() to annotate the domain as discrete.