1

I have 24 groups that I have plotted using geom_line in ggplot2. I was wondering whether there is a quick way to change the colour of one of those particular groups to black without specifying the colours of the other 23?

My code:

ggplot(max, aes(x = dap,y = cf, group=variables, colour = variables)) +
                  geom_line(size=0.5) 
joran
  • 163,977
  • 32
  • 423
  • 453
user2726449
  • 557
  • 2
  • 8
  • 21
  • possible duplicate of [R: changing line colors with ggplot()](http://stackoverflow.com/questions/5171263/r-changing-line-colors-with-ggplot) – hrbrmstr Apr 09 '14 at 15:26
  • Yep - that is what I'm using... but I want to try and not specify the colours of every other group and just override the colour of just one. – user2726449 Apr 09 '14 at 15:31
  • 2
    If you know the order of the groups (they're factors, so it shld be easy to do that) then you can use `rep` to generate the vector of colors and just substitute one color in the position of the one you want to highlight. i.e. `line.cols – hrbrmstr Apr 09 '14 at 15:33
  • I could but I still want the other groups to be different colours. – user2726449 Apr 09 '14 at 15:42
  • 1
    `line.cols – hrbrmstr Apr 09 '14 at 15:46

0 Answers0