šŸ  back to Observable

Overlaying a facet in Plot

Hi,

Is there a way to overlay a small multiples plot in Plot with a subset of the data? My attempt below is displaying all of the subsetted values in each facet.

Plot.plot({
  facet: {
    data : mpg,
    x: "class"
    },
  marks: [
    Plot.dot(mpg, {x: "displ", y: "hwy", stroke: "#bdbdbd", strokeWidth: 1}),
    Plot.dot(mpg.filter(d => d.manufacturer === "audi"), {x: "displ", y: "hwy", fill: "steelblue"}),
    [Plot.frame()]
  ]
})

facet

Thanks for your help!

This is what Iā€™m looking for:

try

    Plot.dot(mpg, {
      filter: (d) => d.manufacturer === "audi",
      ...
1 Like

Magic! It works. Thanks @Fil

1 Like