I am trying to create a stacked area graph. I'm completely new at R so simple functions like these are still a bit hard... I used the following code:
# stacked area chart
ggplot(specimens_all_together, aes(x=`samplesite`, y =`value`, fill=`variable`)) +
geom_area(mapping = NULL,
data = specimens_all_together,
stat = "identity",
position = "stack",
na.rm = FALSE,
orientation = NA,
show.legend = NA,
inherit.aes = TRUE,
outline.type = "upper")
The table I am referring to (specimens_all_together_) has been loaded in from excell and kinda looks like (i simplified the names a bit):
sample site | variable | value
I | worm | 5
I | bird | 6
I |fish | 3
II | worm | 0
II | bird | 0
III | fish | 1
IV | worm | 5
IV | bird | 3
IV | fish | 0
.... | ... |...
but when i do all this, i get a graph with on the Y-axis indeed the values, a really nice legend with all worm, bird and fish types, on the x-axis I also see the sample site values, but the stacked graph, aka the 'fill' is missing. So its just an empty graph. What am I doing wrong???
PS: when i use the geom_bar(position='stack', stat='identity'), i do get a stacked bar plot so I am a bit confused.