I generate a multipanel plot using ggplot2 (requires ggplot2 package). Each of the ten panels represents a different plant growth form. I need to plot a line in each panel that has a slope of 0.704. However, the intercept should be different for each panel, for example -7.9 in the case of 'fern', -7.31 for 'fern ally', etc. Currently, I use the code below which generates a line where both slope and intercept are the same in each panel:
ggplot(veg, aes(x=ord1, y=log(lai+0.000019))) +
scale_x_discrete(limits=c("1","2","3","4","5","6","7","8","9")) +
scale_y_continuous(limits=c(-12,3)) +
geom_point(shape=1) +
geom_segment(aes(x = 1, xend = 9, y = -8.32 + .704, yend = -8.32 + .704*9),
col = "black", size = 1, lty="longdash", lwd=1) +
facet_wrap( ~ plant_growth_form, ncol=5)
How could I modify this code in ggplot2 to specify a different intercept for each growth form?
A reproducible data subset generated with dput() can be found at: How to compute standard errors for predicted data