-
I noticed that the shape of the data for a stacked bar chart and grouped bar chart shown in plot documentation is quite different. Is it easily possible to use the same shape of data for both charts to create a group and stacked bar chart to keep the data formatting needed to a minimum? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
The shape of the data consumed by Plot is about the same in both examples; it's a "tidy" array with one element for each value, and fields that indicate the categories in which this value belongs. in crimea: in stateage: what's different between the examples is the shape of the file that stores the data; the stateage example shows how to reshape a "wide" file to extract it as tidy data. |
Beta Was this translation helpful? Give feedback.
The shape of the data consumed by Plot is about the same in both examples; it's a "tidy" array with one element for each value, and fields that indicate the categories in which this value belongs.
in crimea:
[{date: 1854-04-01, cause: "disease", deaths: 1}, ...]; // value is "deaths"
in stateage:
[{state: "AL", age: "<10", population: 598478}, ...] // value is "population"
what's different between the examples is the shape of the file that stores the data; the stateage example shows how to reshape a "wide" file to extract it as tidy data.