{
const v1 = (d) => d.sales;
const v2 = (d) => d.efficiency;
const y2 = d3.scaleLinear(d3.extent(cars, v2), [0, d3.max(cars, v1)]);
return Plot.plot({
x: {tickFormat: ""},
y: {axis: "left", label: "sales (M)", transform: (d) => d / 1e6},
marks: [
Plot.axisY(y2.ticks(), {color: "steelblue", anchor: "right", label: "efficiency (mpg)", y: y2, tickFormat: y2.tickFormat()}),
Plot.ruleY([0]),
Plot.lineY(cars, {x: "year", y: v1}),
Plot.lineY(cars, Plot.mapY((D) => D.map(y2), {x: "year", y: v2, stroke: "steelblue"}))
]
});
}