Skip to content

asDiscrete: the levels parameter works inconsistently with values of int type #252

Open
@IKupriyanov-HORIS

Description

@IKupriyanov-HORIS

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:

%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)
}

image

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

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

Version:

Lets-Plot Kotlin API v.4.7.3. Frontend: Notebook with dynamically loaded JS. Lets-Plot JS v.4.3.3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions