I am making a bar graph, that is split into three groups (Dft, dt, and ft). In each group, there should be three time periods, which each have two bars (one for male and female).
I've been able to mostly achieve this, except it seems like the values for the male and female groups are combined, although the y axis is set to only the y values.
Here is my table:
> my.table
my.condition my.periods my.prevalence my.gender
1 dft 1988-1994 0.95 Male
2 dt 1988-1994 1.06 Male
3 ft 1988-1994 0.68 Male
4 dft 1999-2004 0.65 Male
5 dt 1999-2004 0.27 Male
6 ft 1999-2004 0.4 Male
7 dft 2011-2014 1.24 Male
8 dt 2011-2014 1.0900000000000001 Male
9 ft 2011-2014 0.7 Male
10 dft 1988-1994 0.71 Female
11 dt 1988-1994 0.55000000000000004 Female
12 ft 1988-1994 0.38 Female
13 dft 1999-2004 1.06 Female
14 dt 1999-2004 1.05 Female
15 ft 1999-2004 0.28000000000000003 Female
16 dft 2011-2014 0.32 Female
17 dt 2011-2014 0.78 Female
18 ft 2011-2014 0.74 Female
And here is the code for producing the bar-graph.
ggplot(my.table, aes(y=my.table$my.prevalence, x=my.table$my.periods, fill=my.table$my.gender)) +
geom_bar( stat="identity") +
facet_wrap(~my.table$my.condition)
I am trying to get the red and blue bars to sit next to each other basically.