-
How can I use multiple channels in a single mark? For example, I'm trying to plot multiple series each over multiple years in a single plot. const data = [
{ x: 0, y: 0, year: 2000, species: "dog" },
{ x: 5, y: 2, year: 2000, species: "dog" },
{ x: 0, y: 0, year: 2001, species: "dog" },
{ x: 5, y: 3, year: 2001, species: "dog" },
// ... more years
{ x: 0, y: 0, year: 2000, species: "cat" },
{ x: 5, y: 4, year: 2000, species: "cat" },
{ x: 0, y: 0, year: 2001, species: "cat" },
{ x: 5, y: 5, year: 2001, species: "cat" },
// ... more years
// ... more species
]; I could use different marks but this doesn't scale. Plot.plot({
document,
color: { legend: true },
marks: [
Plot.line(data, {
filter: d => d.year === 2000,
x: "x",
y: "y",
stroke: "species",
}),
Plot.line(data, {
filter: d => d.year === 2001,
x: "x",
y: "y",
stroke: "species",
}),
// ... more years
],
}); I tried to use Plot.plot({
color: { legend: true },
marks: [
Plot.line(data, {
x: "x",
y: "y",
stroke: "species",
// todo: somehow this doesn't apply
z: "year",
}),
],
}); Is this a known limitation? What's the best approach here? |
Beta Was this translation helpful? Give feedback.
Answered by
Fil
Mar 4, 2024
Replies: 1 comment
-
z should identify individual series, in this case probably something like:
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
vwkd
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
z should identify individual series, in this case probably something like: