Thank you, but I was hoping to use less code, not more.
It seems like there should be a way to update the legend title without having to do it twice. For example, if I just do the following...
guides(fill = guide_legend(title="Species"))
...that results in two legends.
Likewise, the following results in two legends being created:
ggplot(eff_out, aes(x = x, y = predicted, color = group)) +
geom_line() +
geom_ribbon(aes(ymin = conf.low, ymax = conf.high, fill = group),
alpha = 1/5) +
scale_x_continuous("Sepal Width") +
scale_y_continuous("Sepal Length") +
scale_color_discrete("Species")
To prevent that, the only thing I have figured out to do is to update both scales:
ggplot(eff_out, aes(x = x, y = predicted, color = group)) +
geom_line() +
geom_ribbon(aes(ymin = conf.low, ymax = conf.high, fill = group),
alpha = 1/5) +
scale_x_continuous("Sepal Width") +
scale_y_continuous("Sepal Length") +
scale_color_discrete("Species") +
scale_fill_discrete("Species")
Or using guide_legend() twice.