I have a data frame that summarizes the number of people living in different household sizes for different age groups in both urban and rural areas. I'd like to visualize the population values in stacked plots so that the length of each section corresponds to the population counts living in that household size for an age group in either rural or urban areas. I have created these two plots so far but neither is what I want.
First effort:
Second effort:
They are not what I want because they use the same colors for household sizes (s1:s7) in both urban and rural areas. Instead, I want to have 7 shades of green for rural areas and 7 shades of red for urban areas so that these two settings can be easily distinguished in the plot.
Is there any way in ggplot2 to show the values based on two criteria (urban vs. rural, household sizes)? If so, how could it be reflected in the legend?
Thanks so much in advance for your help!
scale_fill_brewer
or the like. – alistaire