I am doing a plot in ggplot2 that contains geom_pointrange and geom_line. I see that when I change the order of the geometries, either the points are built on top of the line, or vice versa. The legend also changes geometry from above to another, based on the same geometry order. However, I would like the line to be drawn first, then the pointer above, in the plot itself, with the opposite in the legend. Is it possible? I would really appreciate any material.
Here is the code I used to create the drawing.
md.figd2 <- structure(list(date = c("2013-05-28", "2013-07-11", "2013-09-22", "2013-05-28", "2013-07-11", "2013-09-22", "2013-05-28", "2013-07-11", "2013-09-22"), trt = structure(c(3L, 3L, 3L, 1L, 1L, 1L, 2L, 2L, 2L), .Label = c("- Fescue", "- Random", "Control"), class = "factor"), means = c(1, 0.921865257043089, 0.793438250521971, 1, 0.878305313846414, 0.85698797555687, 1, 0.840679145697309, 0.798547331410388 ), mins = c(1, 0.87709562979756, 0.72278951032918, 1, 0.816185624483356, 0.763720265496049, 1, 0.780804129401513, 0.717089626439849 ), maxes = c(1, 0.966634884288619, 0.864086990714762, 1, 0.940425003209472, 0.950255685617691, 1, 0.900554161993105, 0.880005036380927)), .Names = c("date", "trt", "means", "mins", "maxes"), row.names = c(NA, 9L), class = "data.frame") library(ggplot2) dplot1.ysc <- scale_y_continuous(limits=c(0,1), breaks=seq(0,1,.2), name='Proportion mass lost') dplot1.xsc <- scale_x_date(limits=as.Date(c('2013-05-23', '2013-10-03')), labels=c('May 28', 'July 11', 'Sep 22'), breaks=md.figdata$date, name='Date') dplot1.csc <- scale_color_manual(values=c('grey20','grey50','grey80')) dplot1.lsc <- scale_linetype_manual(values=c('solid','dotted','dashed')) djitter <- rep(c(0,-1,1), each=3)