Given data such as
df <- data.frame(Site="A",Depth=0:-20,comp=c(rep("sable",14),rep("gres",7)))
df <- rbind(df,data.frame(Site="B",Depth=0:-15,comp=c(rep("sable",3),rep("gres",13))))
I want to plot Depth vs. Site colored by comp. I try:
ggplot(data=df) +
geom_col(aes(Site, Depth,fill = comp)) + labs(y = "Depth (m)")
but get a y axis that does not correspond to my data, why? any fix? I have also tried:
ggplot(data=df) +
geom_line(aes(Site, Depth,col = comp),size=8) + labs(y = "Depth (m)")
There the y axis is correct, but segments are discontinuous and lines do not let me fill with patterns. I've seen package aqp, but does not use ggplot-based plots. Any help appreciated.