Gradient Plot Recipe

Density gradient strips showing car acceleration distributions by origin
Category strips filled by sampled relative density with median rules.

Minimal flow

Runnable: install ggaction and provide the named data array as plain row objects.

import { chart } from "ggaction";

const program = chart()
  .createCanvas({ margin: { top: 70, right: 150, bottom: 70, left: 70 } })
  .createData({ values: cars })
  .createGradientPlot({
    x: "Origin",
    y: "Acceleration"
  })
  .encodeColor({ field: "Origin" });

cars is an array of plain row objects with one categorical field and one quantitative measure.

You must decide

The library infers

Use editGradientPlot to change bandwidth, sample count, strip width, paint, or center statistic without rebuilding the program manually.

Continue

Gradient Plots API · Box-plot recipe · Violin-plot recipe