Grouped bar chart and faceting already grouped data. #2246
-
Hello, I have data with three columns: time, value A, and value B. Time represents the beginning of a period. I want to plot the data as a grouped bar chart, with two different colored bars showing values A and B for each period. I have created an interval object that correctly processes the periods. Now I have problems with faceting. Currently, I have this: Plot.plot({
fx: { interval: PERIOD_INTERVAL },
marks: [
Plot.barY(data, {
fx: "start",
x: ["A"],
y: "a",
fill: "red",
}),
Plot.barY(data, {
fx: "start",
x: ["B"],
y: "b",
fill: "blue",
}),
],
}); It only displays the first bar group but shows the correct labels. Thank you in advance for any help. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I'm surprised by how "blue" and "red" turned out green and purple, though |
Beta Was this translation helpful? Give feedback.
x: ["A"],
defines a channel of length 1, so only one bar will be produced. Maybe what you need instead isx: () => "A",
I'm surprised by how "blue" and "red" turned out green and purple, though