Skip to content

New syntax for declaring facets from a mark #1081

Closed
@mbostock

Description

@mbostock

Broken out of #1041 and 0c2fadf.

Instead of this:

Plot.plot({
  facets: {
    data: penuins,
    x: "sex",
    y: "island"
  },
  marks: [
    Plot.dot(penguins, {
      x: "culmen_length_mm",
      y: "culmen_depth_mm"
    })
  ]
})

You could say:

Plot.plot({
  marks: [
    Plot.dot(penguins, {
      x: "culmen_length_mm",
      y: "culmen_depth_mm",
      fx: "sex",
      fy: "island"
    })
  ]
})

Or in shorthand, instead of this:

Plot.dot(penguins, {
  x: "culmen_length_mm",
  y: "culmen_depth_mm"
}).plot({
  facets: {
    data: penuins,
    x: "sex",
    y: "island"
  }
})

You could say:

Plot.dot(penguins, {x: "culmen_length_mm", y: "culmen_depth_mm", fx: "sex", fy: "island"}).plot()

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions