Skip to content

Crash combining exclude and mark-level faceting #1198

Closed
@mbostock

Description

@mbostock

The Plot.text mark here crashes:

Plot.plot({
  height: 600,
  grid: true,
  facet: {
    data: penguins,
    x: "sex",
    y: "species",
    marginRight: 80
  },
  marks: [
    Plot.frame(),
    Plot.dot(penguins, {facet: "exclude", x: "culmen_depth_mm", y: "culmen_length_mm", r: 2, fill: "#ddd"}),
    Plot.dot(penguins, {x: "culmen_depth_mm", y: "culmen_length_mm"}),
    Plot.text(d3.union(penguins.map((d) => d.sex)), {fx: (d) => d, x: null, fill: "red"})
  ]
})

The crash occurs computing excludeIndex because the index is sparse, containing undefined entries:

Screenshot 2022-12-26 at 5 11 56 PM

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn’t working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions