creating a transform

last updated: Mar 02, 2024

The documentation is a little skimpy on this.

Here's a no-op transform function that accepts x and y parameters:

function noop({ x, y, ...options }) {
  return {
    ...Plot.transform(options, (data, facets, options) => {
      return { data, facets };
    }),
    x: x,
    y: y,
    ...options,
  };
}

You can call it like:

Plot.plot({
  marks: [Plot.line(someData, noop({ x: "alpha", y: "beta" }))],
});
↑ up