Suppose I have a dataset, for example:
set.seed(1)
dataset <- data.frame(x = sort(rnorm(100)),
y = sort(rlnorm(100))+1:4,
group=rep(letters[1:4], 25))
I would like to create a graph using ggplot2. Instead of manually selecting colors, I use a predefined set of colors Paired:
ggplot(dataset, aes(x = x, colour = group)) +
geom_line(aes(y=y)) +
scale_colour_brewer(palette="Paired")
I get a graph as shown below: data points for groups aand bare located in two shades of blue, while the data points for groups cand dare located in two shades of green.

Suppose now that I would only like to build the data corresponding to the groups cand d, and I would like to use two shades of green. If I just do the following:
ggplot(dataset[dataset$group %in% c("c", "d"),], aes(x = x, colour = group)) +
geom_line(aes(y=y)) +
scale_colour_brewer(palette="Paired")
(. ), Paired.

, : , ggplot2