It's a bit cluttered, I know, but I'm trying to further divide the data that makes up my stacked bar chart. Here's what it looks like so far:
A = ggplot(data=yield,aes(N,Mean.Yield,fill=Cutting))
B=A+facet_grid(Location~Mngmt)+geom_bar(stat="identity")
B+labs(x="Nitrogen Level")+labs(y="Yield (lb/acre)")
Yielding this graph: (I would post the graph but apparently my reputation isn't up to snuff as a new member!)
How can I further divide the bars by the factor "species"? I'm assuming it involves adding another geom, but I'm new to all this. Thanks!
Edited to add:
Attempting to use mtcars
for dummy data, though not the best as mpg is not additive like yield over two cutting is in my data.
mtcars$cyl=as.factor(mtcars$cyl)
mtcars$vs=as.factor(mtcars$vs)
mtcars$am=as.factor(mtcars$am)
mtcars$gear=as.factor(mtcars$gear)
mtcars$carb=as.factor(mtcars$carb)
A = ggplot(data=mtcars,aes(cyl,mpg,fill=gear))
B=A+facet_grid(am~vs)+geom_bar(stat="identity")
This yields this ugly graph: https://i.stack.imgur.com/WHT8d.png(https://i.stack.imgur.com/WHT8d.png) I'm hoping to split each of those bars (e.g., cylinders
) into two side by side bars (in this example, 6 side by side bars denoting the mpg of engines with varying levels of carb
for each cylinder factor). I hope this makes sense. Thanks again!