Colour a single line amongst many when coloured by group

I'm afraid this is probably a stupid question, but I've looked everywhere and can't find an answer. I'm plotting a simple line graph, albeit with lots of lines. I want all the lines except one to be one colour (ideally a mid gray), and one particular line to be a bright orange. The lines are being coloured by 'Parish'. Any help very gratefully received!

ggplot(prec, aes(x=Year, y=Amount, group=Parish)) + geom_line(aes(color=Parish)) + theme(legend.position="bottom")

This is not very elegant but it should give you a start.
It is worth reading up on colours and colour palettes in ggplot2 to get something better. Something like this is a start
ggplot2 colors : How to change colors automatically and manually?

DT <- data.frame(aa = sample(LETTERS[1:5], 50, replace = TRUE), bb = rnorm(50),
                 cc = sample(1:10, 50, replace = TRUE))

ggplot(DT, aes(cc, bb, colour = aa)) + geom_line() +
  scale_color_manual(values=c("#999999", "#999999", "#999999","#999999",

1 Like

Thankyou! I'll have a play with that and a read of the link! Much appreciated!

even easier:

ggplot(DT, aes(cc, bb, colour = aa)) + geom_line() +
  scale_color_manual(values=c("E" = "#E69F00"), na.value = "#999999")

Ah, very nice. I would never have thought of that.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.