It seems that segments are required, not lines; i.e. use geom_segment()instead geom_line(). geom_segmentx and y coordinates are required for the start and end points of the segments. Getting the end y value is a little cumbersome. But it works with your data frame, assuming that for each “Well” there are 30 observations, and the order for the “Sequence” is the same for each “Well”.
library(ggplot2)
df = CombinedThickness2[CombinedThickness2$DepSequence == "Original",]
index = 1:dim(df)[1]
NWell = length(unique(df$Well))
df$DepthEnd[index] = df$Depth[index + dim(df)[1]/NWell]
BarWidth = 0.3
plot11 = ggplot(df,
aes(x = Well, y = Thickness, fill = Sequence, alpha = Visible)) +
geom_bar(stat = "identity", width = BarWidth) +
scale_y_reverse() + scale_alpha(guide = "none")
plot11 = plot11 +
geom_segment(aes(x = as.numeric(Well) + 0.5*BarWidth, xend = as.numeric(Well) + (1-0.5*BarWidth),
y = Depth, yend = DepthEnd, color = Sequence))
plot11

source
share