I can make this stacked barchart with data table in Excel.
stacked barchart with data table:
I can make the barchart in R
library(ggplot2)
specie <- c(rep("sorgho" , 4) , rep("poacee" , 4) , rep("banana" , 4) , rep("triticum" , 4) )
condition <- rep(c("big", "really big", "huge", "tiny"))
value <- abs(rnorm(16 , 0 , 15))
data <- data.frame(specie,condition,value)
cbPalette <- c("#798320","#c0cf3a", "#0276c3", "#025b97")
ggplot(data, aes(fill=condition, y=value, x=specie)) +
geom_bar(position="stack", stat="identity") + ggtitle("title") + scale_fill_manual(values=cbPalette)
But I can't seem to find any way to make the data table be part of the barchart.
I can make a separate table and fiddle with it to get it to align to the X-axis of the graph but that seems clunky.
Any ideas?