Skip to content

geomRibbon with multiple colors doesn't look as expected #1384

@marvk

Description

@marvk
Image

Expected Result

  • Ribbons get filled without overlapping, connected polygons
  • Ribbon lines are continuous with differing color depending on the color parameter

Actual Result

  • Ribbonn fills overlap
  • Ribbon lines are not continious, line sections of one color are connected instead of being up by another color

Steps

See MCVE below

MCVE

Dependencies:

implementation("org.jetbrains.lets-plot", "lets-plot-common", "4.7.0")
implementation("org.jetbrains.lets-plot", "lets-plot-image-export", "4.7.0")
implementation("org.jetbrains.lets-plot", "lets-plot-kotlin-jvm", "4.11.0")
import org.jetbrains.kotlinx.dataframe.api.dataFrameOf
import org.jetbrains.kotlinx.dataframe.api.toMap
import org.jetbrains.letsPlot.export.ggsave
import org.jetbrains.letsPlot.geom.geomRibbon
import org.jetbrains.letsPlot.letsPlot
import kotlin.math.max
import kotlin.math.min
import kotlin.math.sin

fun main() {
    val n = 60
    val a = List(n) { sin(it / 10.0) * 20 }
    val b = List(n) { sin(it / 6.0 + 1) * 20 - 2 }

    val df =
        dataFrameOf(
            "x" to List(n) { it },
            "min" to a.zip(b).map { min(it.first, it.second) },
            "max" to a.zip(b).map { max(it.first, it.second) },
            "label" to a.zip(b).map { if (it.first > it.second) "a" else "b" },
        )

    val plot =
        letsPlot(df.toMap()) +
                geomRibbon(alpha = 0.2) {
                    x = "x"
                    ymin = "min"
                    ymax = "max"
                    fill = "label"
                    color = "label"
                }

    ggsave(plot, "issue.png", path = ".")
}

Metadata

Metadata

Labels

documentationMissing/incorrect documentation

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions