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:

enter image description here

i think order listed order drawn putting geom_segment last should it.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -