Recently I’ve needed to plot compositional data by one or more groups. These are usually in the form of a categorical variable (ordered or not) and a binary variable to distinguish two groups; e.g., minority status or poverty (0/1). I was struggling to plot the categorical variable across the two groups so that the bars sum to 100% for each group. Let’s start with a simple example.

Data is from IPUMS. My data is (here) with setup (here). We have an exhaustive five category grouping of family structure: (1) two adults no working woman, (2) two adults with working woman, (3) single woman not working, (4) single woman working, and (5) single male.

Let’s say we want to examine poverty status across family structure. Poverty is measured using the US Census official poverty measure. We want to analyze the family structure compositions of the poor versus non-poor. Continue reading