Nutrition consultant
Normal user
24 Jun 2015, 13:02
I wonder if anyone can help me - I am trying to produce an area graph for breastfeeding practices (EBF/ BF with water/ BF with other milks etc) from survey data and cannot work out how to do it without a very lengthy process of counting practices for each month of age. I am using Stata and Excel, so if anyone knows how to produce one on either of these programmes I would be very grateful for the advice!
Consultant Epidemiologist
Frequent user
25 Jun 2015, 10:51
I find area charts quite tricky to read.
Stacked bar chart with bars at each month and no space between the bars might be easier to read.
Anyway ... I assume you have an age variable in months (let us call it age) and a variable that codes for milk as (e.g. 1 = EBF, 2 = BF with water, 2 = BF with other milk, 3 = Other milk, 54 = No milk) - let us call it milk).
If you do not have such a variable (e.g. you may have one Y/N variable per milk type) then you can make a new variable from existing variables.
Here I use R (it is what I know) but the process should be the same in STATA or SPSS or Epi-Info or SAS or ...
Make a table of age (rows) by milk (columns) and plot the table:
plot(table(age, milk))
or (the other way round and plotting counts):
barplot(table(milk, age))
You can just take the able of age (rows) by milk (columns), import it into Excel (you may be able to copy and paste), and plot the data as a stacked bar chart (data in rows). Most spreadsheet packages will plot so all categories sum to 100% or plot counts.
Is this any help?
Nutrition consultant
Normal user
25 Jun 2015, 14:17
I agree that they are hard to read - but it seems a standard way to present this data.
This was really helpful Mark thank-you! I now have an area graph :)