Hi:
Does this work for you?
ggplot(delme, aes(x = doy2, y = NEE_st)) +
geom_point(aes(colour = as.factor(cod))) +
geom_smooth(size = 1, colour = 'blue') +
labs(x = 'Day of year', colour = 'cod') +
facet_grid(YEAR ~ .) +
scale_colour_manual(values = c('orange', 'purple'))
I changed the point sizes to reduce the effect of overplotting and the
colors to be friendlier to those with color blindness. To get colors
by cod level but a single overall smooth for a given year, you need to
remove colour as an aesthetic in the top level qplot/ggplot() call and
reserve it for the geom_point() layer, as Brandon showed you. When
colour = is in the top level call, it is assumed to be present in
*all* subsequent layers. In this case, you want color differentiation
in the geom_point() layer but not the geom_smooth() layer, which is
why you don't want colour = in the qplot/ggplot() call.
HTH,
Dennis