Trying to create a stacked bar plot with depth (in meters) on the y-axis and different categories on the x-axis and then filled with abundance values. However, ggplot2 keeps summing all the depth values (a+b+c) so that the y-axis isn't correct.
I know I need to specify geom_bar(stat = "identity"), but this seems to mess with the y-axis since all of the groups have the same values, but differing abundances.
##Data:
Phylum Depth Abundance
Cnidaria 110 6
Cnidaria 90 12
Cnidaria 70 1
Cnidaria 50 4
Cnidaria 30 3
Cnidaria 20 1
Cnidaria 120 13
Cnidaria 80 3
Cnidaria 60 12
Arthropada 110 105
Arthropada 90 493
Arthropada 70 23
Arthropada 50 3
Arthropada 30 10
Arthropada 20 42
Arthropada 120 57
Arthropada 80 3
Arthropada 60 7
##Current plot:
ggplot(data = data, aes(x = Phylum, y = Depth, fill = Abundance)) +
geom_bar(stat = "identity")
The current plot outputs the data with the y-axis summed to 600 m when the highest value should only be 120 m.