r - Plot geom_segment on geom_rect background -
i want plot line segments (to precise: geom_segment
element) on geom_rect
dark green fill.
i use following code:
ggplot(data, aes(x=x0, y=y0, xend=x1, yend=y1))+ geom_segment(aes(colour=result)) + scale_colour_manual(values=c("green", "red"))+ theme(panel.background = element_rect(), panel.grid.major = element_line( colour = "white") )+ scale_y_continuous(breaks=seq(20,100, by=5))+ geom_rect(aes(xmin = 0, xmax = 100, ymin = 62, ymax = 100), fill = "grey") + geom_rect(aes(xmin = 0, xmax = 100, ymin = 60, ymax = 62), fill = "darkgreen")+ geom_rect(aes(xmin = 0 , xmax = 100, ymin = 50, ymax = 60), fill = "darkgreen", colour = "white", size = 1)+ geom_rect(aes(xmin = 50, xmax = 50, ymin = 60, ymax = 65), fill = "yellow", colour = "yellow", size = 4)
... on.
this gives me:
i think order listed order drawn putting geom_segment last should it.
Comments
Post a Comment