JetBrains / JetBrains/lets-plot-kotlin
asDiscrete: the levels parameter works inconsistently with values of int type
- Dominant language
- Kotlin
- Stars
- 486
- Forks
- 39
- PR merge metrics
- No merged PRs in 30d
Description
In the legend, I expect the order `3, 2, 1` (reversed, `order=-1`) for `levels=1, 2, 3`. The actual order is `2, 1, 3`, which looks like the reversed data order, i.e., the levels parameter is ignored:
```kotlin
%useLatestDescriptors
%use lets-plot
val d = mapOf(
"x" to listOf(0, 1, 2),
"v" to listOf(3, 1, 2),
)
ggplot(d) + geomPoint {
x = "x";
color = asDiscrete("v", levels=listOf(1, 2, 3), order=-1)
}
```

Without `order=-1`, the int levels are handled properly:

With doubles, the `levels` parameters handled properly even with the `order` parameter:

Version:
```
Lets-Plot Kotlin API v.4.7.3. Frontend: Notebook with dynamically loaded JS. Lets-Plot JS v.4.3.3.
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.