Using GapMinder data, I've made the plot below with a different regression line by continent:
Here is the code:
ggplot(gapminder_82,
aes(gdpPercap, lifeExp, color = continent)) +
geom_point() +
scale_x_log10() +
scale_color_brewer(palette = "Set2") +
geom_smooth(method = "lm", se = F)
The problem is that the lines aren't really visible. So I'd like to use 2 different color palettes from color brewer. The Pastel2 for the points, but I'd like to use "Dark2" for the lines. It would make the lines stand out.
How would I do it?
You can use a filled point shape for the points, allowing you to use a fill scale for the points and colour for the lines:
ggplot(gapminder_82,
aes(gdpPercap, lifeExp)) +
# Make the edge color for the points totally transparent
geom_point(aes(fill = continent), shape = 21, size = 3, colour = "#FFFFFF00") +
scale_x_log10() +
geom_smooth(aes(color = continent), method = "lm", se = F) +
scale_fill_brewer(palette = "Pastel2") +
scale_color_brewer(palette = "Dark2") +
theme_bw()
Result: