Hello all,
I am trying to make this graph in R:
However, I am not sure how to make the heights of each rectangle reset when their is no overlap.
The data frame that I am using is as follows:
data = data.frame("x"=c(1,1,1,5,5,7,7,10),
"y"=c(15,12,8,15,10,10,13,15),
"d"=c(1,2,3,4,5,6,7,8))
And a simplified version of the code is below:
ggplot() +
geom_rect(data=data,mapping=aes(xmin=x,xmax=y,ymin=d-0.4,ymax=d+0.4))
However, this is not quite right...
Any help would be appreciated!