JetBrains / lets-plot-kotlin

Grammar of Graphics for Kotlin
https://lets-plot.org/kotlin/
MIT License
419 stars 36 forks source link

Lollipop in legend is disproportionately large. #216

Closed alshan closed 8 months ago

alshan commented 8 months ago
val estimated = listOf(0.2, 0.3, 0.4, 0.1)
val observed = listOf(1, 2, 3, 4) 
val probability = listOf(0.19, 0.31, 0.42, 0.08)
val values = listOf(1, 2, 3, 4)

val data = mapOf(
    "xs" to observed + values,
    "ys" to estimated + probability,
    "group" to List(4) {"A"} + List(4) {"B"}
)

var p = ggplot(data) + theme().legendPositionRight() +
    geomLollipop(position = positionDodge(0.3)) {
        x = "xs"
        y = "ys"
        color = "group"
    } + scaleColorManual(values=listOf("red", "black"))

p = p + labs(title = "some title", x = "xLabel", y = "yLabel") +
            ggsize(500, 350)

image

alshan commented 8 months ago

Source: https://stackoverflow.com/questions/77294632/how-to-add-legend-to-lets-plot-kotlin-when-not-based-on-data-map