Skip to content

Shape of data for grouped/stacked bar chart #981

Answered by Fil
dgwyer asked this question in Q&A
Discussion options

You must be logged in to vote

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.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@dgwyer
Comment options

@dgwyer
Comment options

@Fil
Comment options

@dgwyer
Comment options

Answer selected by Fil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants