I am trying to create a graph that displays the abundance of species over time. I would like for the final graph to look like something produced using geom_density, with smooth curves for each species. For example, Figure 1 on this site (Figure 1). However, I have not been able to manipulate R into using my y values (abundances) instead of density counts. I did manage to use geom_area, but this isn't really the output that I would like. Does anyone know how to make geom_density accept y values? Or alternatively, plot species abundances with smooth curves?
Example:
data.set <- data.frame(
Time = c(rep(1, 4),rep(2, 4), rep(3, 4), rep(4, 4)),
Type = rep(c('a', 'b', 'c', 'd'), 4),
Value = rpois(16, 10)
)
Where the Value is species abundance, Time is the timepoint that each abundance was recorded and Type represents the four different species.
ggplot(data.set, aes(Time, Value)) + geom_area(aes(fill = Type))
Once plotted, it is very "chunky." I would prefer to use something like geom_density to make smooth curves and then use alpha to make them transparent.
Any help would be appreciated!