0
votes

With ggplot, I plot a figure like this

df = data.frame(xx= seq(1,100),yy=rnorm(100)*2,
                zz = rep(c("a","b"),50))

ggplot(aes(x = xx, y = yy, color = zz, group = zz), data = df) + geom_smooth() + geom_point() + theme_bw() 
  theme(legend.title=element_blank())

`

My original dataset has a lot of dots. Because of the same color between smoothing lines and dots in same groups, this type of figure with my data is so messy.

I would like to make pale color (or change color manually) for dots and show the lines more clearly.

How to have different colors for dots and lines with such figure?

1
Can you share your data, code & plot? How to make a great R reproducible example?Tung
Thank you. I forgot to add a dataframe. I just edited itJohn legend2

1 Answers

1
votes

If I'm understanding what you want correctly, you have a couple options to make the points stand out:

  • If the standard error shading on the lines is in your way, add se = F to geom_smooth()
  • Decrease the opacity of the points: geom_point(alpha = 0.5)
  • Change the shape of the points, for example to unfilled circles: geom_point(shape = 1)
  • Make the points smaller: geom_point(size = 0.5)

It's up to you which of those routes (or combination of them) you choose, but you can decide which you think is most readable for your purposes.