If you use a grey scale for the points you want to deemphasize, there
should be no problem:
mycolours1 <- c("U" = "darkgreen", "D" = "red", "N"="grey50")
mycolours2 <- c("U" = "darkgreen", "D" = "red", "N"="grey90")
mycolours3 <- c("U" = "darkgreen", "D" = "red", "N"="blue")
library(ggplot2)
# Notice that the levels of z are set in the data frame
# (Aside: Why did I define it this way instead of copying yours?)
DF <- data.frame(x = seq(6), y = seq(6),
z = factor(rep(c("U", "D", "N"), each = 2),
levels = c("U", "D", "N")))
# Modify grey scale
ggplot(data = DF, aes(y = y, x = x)) +
theme_bw() +
geom_point(size=3, aes(colour=z)) +
scale_colour_manual("Status", values = mycolours1)
# Higher values of grey produce lighter shades
ggplot(data = DF, aes(y = y, x = x)) +
theme_bw() +
geom_point(size=3, aes(colour=z)) +
scale_colour_manual("Status", values = mycolours2)
Just tweak the grey value to produce the effect you want.
Another approach is to map the alpha transparency level (aka
'opacity') of each mapped color value. In your example, the levels of
z are "D", "N" and "U", so you can define the values of the opacity
vector accordingly. (This was why I set the levels in the data frame,
BTW.)
# Modify opacity (alpha)
ggplot(data = DF, aes(y = y, x = x)) +
theme_bw() +
geom_point(size=3, aes(colour=z)) +
scale_colour_manual("Status", values = mycolours3)
opacity <- c(1, 1, 0.2) # values correspond to the level ordering of z
ggplot(data = DF, aes(y = y, x = x)) +
theme_bw() +
geom_point(size=3, aes(colour=z)) +
scale_colour_manual("Status",
values = alpha(mycolours3, opacity))
Again, you can adjust the values of opacity to taste.
Dennis