我想在带有深绿色填充的geom_segment
上绘制线段(准确地说:geom_rect
元素)。
我使用以下代码:
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)
......等等。
这给了我:
答案 0 :(得分:0)
我认为列出的顺序是绘制的顺序,因此最后放置geom_segment应该这样做。