function demoplot({
colorRange = colorsDifficult,
symbolSpec = "circle",
ariaDescription = "This plot needs a description."
} = {}) {
return Plot.plot({
ariaLabel:
"Scatterplot showing models of cars; x-axis: power (hp), y-axis: economy (mpg), grouped by number of cylinders.",
ariaDescription,
caption:
"Models of cars: fuel economy vs. engine power, grouped by number of cylinders",
marks: [
Plot.dot(carsFiltered, {
x: "power (hp)",
y: "economy (mpg)",
fill: "cylinders",
symbol: symbolSpec,
r: 5,
opacity: 0.7
})
],
color: {
type: "ordinal",
range: colorRange,
legend: symbolSpec != "cylinders"
},
symbol: {
legend: symbolSpec == "cylinders"
}
});
}